# Jeesie

Member Since 28 Feb 2007
Offline Last Active Today, 02:09 AM

### In Topic: Simplest Platform Movement/Collisions

22 April 2012 - 07:51 PM

Wow, it works great! Thank you very much.

I also made trampolines in my game by adding this to your script:
```if !place_meeting(x, y+1, obj_block)  && (!place_meeting(x,y+1,obj_block_through) or place_meeting(x,y,obj_block_through))
{
grav = 2;
vspd += grav;
}
else if place_meeting(x, y+1, obj_block_jump)
{
vspd = -30;
}
else
{
grav = 0;
vspd = 0;
if keyboard_check_pressed(vk_up)
{
vspd = -22;
}
}```

And also give obj_block_jump a parent: obj_block.

Could you also explain moving platforms?

Edit
I also added another future to the jumpthrough platform:
```if !place_meeting(x, y+1, obj_block)  && (!place_meeting(x,y+1,obj_block_through) or place_meeting(x,y,obj_block_through))  // if we are in the air
{
grav = 2; // set the gravity to .5
vspd += grav; // add .5 to our vspd once every step
}
else if place_meeting(x, y+1, obj_block_jump)
{
vspd = -30;
}
else if place_meeting(x, y+1, obj_block_through) && keyboard_check_pressed(vk_down)
{
self.y = (other.y+1)
}
else // else if we are on the ground
{
grav = 0; // set the gravity to 0
vspd = 0; // set vspd to 0 to stop moving
if keyboard_check_pressed(vk_up) // since we are on the ground, we can handle jumping here, so check if we pressed up
{
vspd = -22; // set the vspd to -8, which will make us jump
}
}```

This will make the obj_player go through the jumpthrough platform (fall down) when you press the down arrow while standing on a jumpthrough platform.
But I know this isn't a good way because the player could get stuck, what do you suggest to do here? This is the part of the code I have added:

```else if place_meeting(x, y+1, obj_block_through) && keyboard_check_pressed(vk_down)
{
self.y = (other.y+1)
}```

Kind regards,

Jeesie

### In Topic: Simplest Platform Movement/Collisions

21 April 2012 - 05:54 PM

Very nice! I am using your script for my new game, but I can't figure out how to make a jumpthrough platform with this code.

I have: obj_player, obj_block and obj_block_jump (the jumptrough platform). This is what I made (isn't working):
```repeat(abs(vspd)) // we want to check for a collision every pixel, so we use a repeat() function to check every pixel while falling
{
if !place_meeting(x, y+sign(vspd), obj_block)  // vspd can be negative or positive, so we check 1 pixel above or below, depending on which direction we are going
{
y += sign(vspd); // add to our y value 1 pixel at a time, letting use check for a collision every pixel
}
else if place_meeting(x, y+sign(vspd), obj_block_jump)
{
y += sign(vspd);
}
else // else if we hit a block
{
vspd = 0; // stop moving vertically
}
}```

Can you help me out?

### In Topic: Online Engine - Registration And Login

25 December 2008 - 10:22 PM

It's very nice, smooth movements. Goodjob, how many peaple can it handle?

Thanks,

### In Topic: Needed - Topdown Sprites!

04 June 2008 - 02:48 PM

Please help someone!

Bump

### In Topic: Michaelshooter (contra Engine)

03 June 2008 - 08:04 PM

Nice job!
Could you make the same thing for a Topdown shooter 2?
Would be great!

thanks,
Jeesie.