Jumping on the trampoline while the animation is playing

sensodyne

Member
Hello all

I have an object that the player is bouncing on ... It's a bit of a parabolic movement and very forward. Everything works fine, but I would like to have this effect on my object.
Now it is so that as soon as the player touches the object, he jumps immediately and I would like the jump to be possible every 3 seconds and it should look like this.
When the object animation plays, only then the player can bounce, and when the object animation is not there, then it cannot bounce. And the sound should be played when the object animation is on, but this sound should also be heard when the player is close to the object


Please help, thank you

obj_trampoline

create

GML:
image_speed = 0;
pwr = 152;
step

GML:
if place_meeting(x,y,par_entity) {
 with instance_place(x,y,par_entity) {
  hspd = lengthdir_x(1,other.image_angle+45)*other.pwr;
  vspd = lengthdir_y(1,other.image_angle+45)*other.pwr;
  audio_play_sound(snd_trampoline, 10, false);
 }
 image_speed = 1;
}

Animation end

GML:
///Reset
image_index = 0;
image_speed = 0;
 
Top