[Solved] Object not loading due to vertical collision code

L

Luxxum

Guest
Hey, I'm new to gamemaker, and working on my first learn-how-this-stuff-works game.

I more or less ripped my vertical collision for jumping straight from
but as I wanted to put dashes into the game (including straight down), I wanted a variable which could tell me the player character's distance from the ground at any point, and came up with:


if place_meeting(x,y+ysp,ground)
{
for (i=0;i<=ysp;i=i+1)
{
if place_meeting (x,y+i+1,ground)
grnd_dist=i
}
ysp=0
y=y+grnd_dist
}

note that the for loop is in a separate script, as I wanted to be able to just call it for each kind of dash.

My problem is that to begin with, the dashes (which were just x/y=x/y+n) weren't playing nice with the collision. jumping worked fine, but any vertical dash (including straight up) would end up with the player character deep inside the ground, with the distance seeming to be based on how high up the dash went. I tried to fiddle with it, and now the player character won't load at all. I ctrl+z'd as far back as I could, but it still won't load.

I think the problem with the vertical collision might be that I need to end it after grnd_dist is set, but I have no idea why the PC isn't loading in, so I'm not gonna mess with it until that is fixed. Any help would be greatly appreciated.
 
L

Luxxum

Guest
for (i=0;i<=ysp;i=i+1)
if place_meeting (x,y+i+1,ground)
{
grnd_dist=i
break;
}
Gotcha, thanks. Any idea what might be causing the character to not load? Some kind of statement clashing or something?
 
Top