my last project i worked primarily with drag and drop programming, but for this project i've started working with gml code, like this piece of collision code that goes in a step event
///friction code///
if (speed > 8) speed = 8;
///collision code///
if hspeed!=0
if !place_free(x+hspeed,y)
{
if hspeed>0 move_contact_solid(0,hspeed)
if hspeed<0 move_contact_solid(180,-hspeed)
hspeed=0
}
if vspeed!=0
if !place_free(x+hspeed,y+vspeed)
{
if vspeed>0 move_contact_solid(270,vspeed)
if vspeed<0 move_contact_solid(90,-vspeed)
vspeed=0
}
so yea, that's fun.
my other codes for directional movement
it's going good.
No comments:
Post a Comment