Jump to content

Photo

Hitboxes


  • Please log in to reply
9 replies to this topic

#1 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 03 March 2018 - 07:30 PM

Is it hard to disable an enemy's hitbox?



#2 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 03 March 2018 - 08:46 PM

npc->CollDetection = false;


#3 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 03 March 2018 - 09:26 PM

How would I apply that to an enemy?



#4 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 04 March 2018 - 03:02 AM

You'd have to load an enemy pointer and then disable collision. Example script that creates an enemy without collision:
ffc script CreateEnemy
{
	void run(int enemy_id, int n, int hp)
	{
		if(n == 0)
			n = 1;

		for(int i = 0;i < n; i++)
		{
			npc e = Screen->CreateNPC(enemy_id);
			if(!e->isValid())
				continue;

			e->CollDetection = false;

			if(hp > 0)
				e->HP = hp;

			e->X = this->X;
			e->Y = this->Y;
		}
	}
}


#5 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 04 March 2018 - 05:48 AM

Ah, so that would work for an enemy placed on the screen to begin with (which I would definitely use), but not for an enemy that appeared as the result of splitting upon hit or death (a second idea).



#6 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 04 March 2018 - 06:01 AM

I've made enemies in the editor that split into invincible enemies, so it can be done. Actually you can do all kinds of magic in the enemy editor regarding splitting and zol'ing enemies that continuously evolve. To be able to turn on/off collision at will you need a script though.

#7 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 04 March 2018 - 07:44 AM

An enemy without a hitbox as a result of splitting was an idea for a "dry bones" type enemy where you can knock it out temporarily, but it always comes back

 

(normal, splits into no-hitbox, tribbles into normal)



#8 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 08 March 2018 - 09:44 AM

I might add a 'No Collision' flag to the Enemy Editor at some point, but: Is it truly needed?

The 2.54 editor can move the enemy hitbox offscreen, by setting HiyYOffset to -32768 (or some other improbably vast number so that it is never on-screen), and enabling the override.

Is there a case for needing the hitbox on-screen, and having it disabled (from the editor)?

#9 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 08 March 2018 - 09:54 AM

Not unless you have some specific scripting plans. Moving it offscreen sounds fine.



#10 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 26 March 2018 - 04:08 AM

You'd have to load an enemy pointer and then disable collision. Example script that creates an enemy without collision:

ffc script CreateEnemy
{
	void run(int enemy_id, int n, int hp)
	{
		if(n == 0)
			n = 1;

		for(int i = 0;i < n; i++)
		{
			npc e = Screen->CreateNPC(enemy_id);
			if(!e->isValid())
				continue;

			e->CollDetection = false;

			if(hp > 0)
				e->HP = hp;

			e->X = this->X;
			e->Y = this->Y;
		}
	}
}

 

I'd like specific Enemy IDs to always have no hitbox, and I want them to be enemies that appear as a result of spilt on hit or split on death (as opposed to creating an enemy).


Edited by Cukeman, 26 March 2018 - 05:19 AM.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users