So, this object is a kind of bouncepad, that just forces the player object to jump when it's on the platform.
This code works perfectly, by the way. It just didn't work unless the "keyboard_key_press (vk_up) ;" line was done every step it needed to be. It's probably not a problem with this code, though. I'd imagine, it'd down to how the player works, and that is WAY too much code for me to show here, and hey, as long as it works, I don't really mind if a tiny bit of the code is messy.
Create event:
state = 1 ;
timer = 0 ;
image_speed = 0 ;
Step event:
switch (state)
{
case 1:
image_index = 0 ;
image_speed = 0 ;
if (place_meeting (x, y-1, Player)) && (Player.x > bbox_left) && (Player.x < bbox_right) && (Player.death = 0) state = 2 ;
break ;
case 2:
image_speed = 0.3 ;
keyboard_key_press (vk_up) ;
if (image_index >= 3)
{
image_index = 3 ;
timer = 0 ;
state = 3 ;
}
break ;
case 3:
if (timer < 10)
{
keyboard_key_press (vk_up) ;
timer += 1 ;
image_speed = 0 ;
}
else
{
keyboard_key_release (vk_up) ;
image_speed = -0.1 ;
if (image_index <= 0) state = 1 ;
}
break ;
}
(sorry about the lack of indents, the forum messed them up)
The first state just detects the player on the platform.
The second state animates the platform, and starts the player's jump.
The third state continues, then ends, the players' jump, as well as playing the platform's animation backwards.