Jumpframe Flipframe

danno

Moderator
Staff member
When kicking someones head off the head flys the same direction regardless of which way the enemy is facing, I would like the head to fly away from the player, heres how I have everything set up.

white ninja enemy
Code:
anim    death4
	delay	150
	offset	55 100
		sound  Data/chars/white/de.wav
	@cmd spawn01 "head" 0 40 0
	frame	data/chars/white/do.png
	frame	data/chars/white/do.png
	frame	data/chars/white/e.png
spawned head
Code:
anim	idle
	delay	100
	offset	8 12
        jumpframe 0 1 1
	frame	data/chars/white/head.png
I tried anichange but with same results
Code:
anim	idle
        bbox  20 20
	delay	1
	offset	8 12
        @cmd anichange openborconstant("ANI_FOLLOW1")
	frame	data/chars/white/head.png

anim	follow1
	delay	100
	offset	8 12
        jumpframe 0 1 1
	frame	data/chars/white/head.png
flip changes left but then right is changed so same but vice versa, do I need to change how "head" is spawned or can I change jumpframe somehow?
https://www.youtube.com/watch?v=YeeoURvMyXc
 
Place this in enemy animation, until then, you can wait for someone else to chime in with better idea
Code:
			@script
                void self = getlocalvar("self");
                	void opp = getentityproperty(self, "opponent");
                      	void ox = getentityproperty(opp, "x");
                      	void sx = getentityproperty(self, "x");

                if ( frame == 1 && ox < sx ){
            changeentityproperty(self, "velocity", 22, 1, 4);

                               		}
                                                  if ( frame == 1 && ox > sx ){
            changeentityproperty(self, "velocity", -22, 1, 4);

                               		}
	@end_script
Its not jump tho, just moving away from player using velocity 22 or -22 for other direction.
You can use this to spawn and toss separate head for left direction and right direction or just change to different animation when you want head to fall left or right instead of changing velocity.
Script compares opponent and enemy placement (x) so when youre behind him it will go to different side than if you hit him from the front.
 
thanks bWWd, when the character is facing right it works perfect, when facing left however the head shoots slightly towards the player then fly's away, if you slow down the playback on the youtube video as the second enemy dies you might see it, I'll try tweaking some stuff to see if I can stop that from happening, much appreciated
https://www.youtube.com/watch?v=YiumAlJqa-8
 
you can stop that, give it velocity 0 0 0 with script at the beginning and in head entity set speed to 0, also in head animation set velocity to 0 on first frame with this before first frame :
@cmd changeentityproperty getlocalvar("self") "velocity" 0 0 0
IT happens because script works on frame 1 not frame 0, so it works on second frame. first frame is frame 0 and it has time to travel before second frame and script will be activated.
you can also change delay of that first frame of head entity to something short like delay 1 and second frame can have longer delay
I run most scripts on frame 1(second frame) and my fist frame have very short delay so its almost invisible.
 
I changed velocity and delay, works ok now, I wanted the head to land on the floor next to the enemy but kicking the head off screen looks good also  :D Thanks for your help bWWd and msmalik
 
I see that you have your problem solved
Since you are using script to spawn the head, why don't you use script also to control where the head is flying?
You should use this function:
Code:
void shooter2(void vName, float fX, float fY, float fZ, float Vx, float Vy, float Vz)
{//Spawns projectile next to caller
 //vName: Model name of entity to be spawned in
 //fX: X location adjustment
 //fZ: Y location adjustment
 //fY: Z location adjustment
 //Vx: X speed
 //Vy: Y speed
 //Vz: Z speed

   void self = getlocalvar("self"); //Get calling entity
   int Direction = getentityproperty(self, "direction");
   void vSpawn; //Spawn object.
	
   vSpawn = spawn01(vName, fX, fY, fZ); //Spawn in projectile
   if (Direction == 0){ //Is entity facing left?                  
      Vx = -Vx; //Reverse Vx direction to match facing
   }

   changeentityproperty(vSpawn, "velocity", Vx, Vz, Vy);
}

This script will spawn an entity and also controls where it flies
This script calls spawn01 function which you already have
 
I can't seem to get toss to work how I'd like to, the trajectory of the head seems off, I'll try Bloodbanes shooter2 and post results later. every time I stop using this engine for awhile I come back feeling like a noob and forgetting simple things I learned over a decade ago  :o

Edit here is the final outlook, thanks guys
https://www.youtube.com/watch?v=YgC_0iKxZNA
 
Looks ok wats wrong with it ? You can use drawmethod rotate to rotate the head when it falls, maybe roll on the floor.
If trajectory is off, try to set velocity to 0 when head is starting to fall off, ideally at first frame it has.with @cmd script
 
bWWd if I am not mistaken, you don't need to use a landframe to bouncefactor takes action. Unlike Mugen, things won't get bellow the ground (unless in holes) in OpenBOR, so the engine will trigger the bounce behaviour once the entity hits the floor.
 
After lots of trial and error I decided on this method,
Script
Code:
void bbounce(void Ani){
	// Check altitude. If projectile is on ground, change animation!
    void self = getlocalvar("self"); // Get self
    int x = getentityproperty(self,"x"); // Get self x pos
    int z = getentityproperty(self,"z"); // Get self z pos
    int y = getentityproperty(self,"a"); // Get self altitude
    int H = checkhole(x,z,y-100); // Checkhole

    if( y <= 1 && H != 1)
	{ // On ground but not on hole?
      changeentityproperty(self, "animation", openborconstant(Ani));
	  // Change to desired animation
    }
}

head entity
Code:
anim	idle	
        loop   0	
        delay 8
	offset	8 12
	@cmd	bbounce "ANI_FOLLOW1"
	frame	data/chars/white/head.png



anim	follow1
        loop   0	
        bbox  20 20
	delay	90
	offset	8 12
	jumpframe	1 1.5 -0.4 0
	landframe	1
        move    -2
	frame	data/chars/white/head.png
        delay   6
	frame	data/chars/white/head1.png
	frame	data/chars/white/head3.png
	frame	data/chars/white/head4.png
	frame	data/chars/white/head1.png
	frame	data/chars/white/head2.png
	frame	data/chars/white/head3.png
	frame	data/chars/white/head4.png
	frame	data/chars/white/head1.png
	frame	data/chars/white/head2.png
	frame	data/chars/white/head3.png
	frame	data/chars/white/head4.png

@ O llu I don't want the animation to be too smooth as I want it to have a megadrive/genisis vibe
 
ahh ok I'll give it a try over the weekend and post results, I think for bigger enemies with bigger heads I'd like to see a smoother bounce, I'll keep you's posted.
 
Back
Top Bottom