If right most of sprite is next to left of object gravity and hspeed is 0 help please.

ThirtyTwo_By_ThirtyTwo_Box_One
Create Event:
Code:
gravity_direction = 360; //right direction with gravity
gravity = 0.37; //gravity is 0.37
hspeed = 13; //hspeed (horizontal speed) is 13 meaning go right constantly (continuously) by 13 pixels until hspeed is less than or greater than 13


Step Event:
Code:
if (instance_exists(ThirtyTwo_By_ThirtyTwo_Box_Two)) //if ThirtyTwo_By_ThirtyTwo_Box_Two is in room
{
  if (place_meeting(x+hspeed-gravity,y,ThirtyTwo_By_ThirtyTwo_Box_Two))
  {
    gravity -= gravity;
    gravity = 0;
    hspeed = 0;
  }
}



Would up above code work like how I want? If I made such a game with such up above objects and codings both objects would have 32 pixels tall and wide sprite with BBox (Bounding Box) Top 0 and BBox Right 32 and BBox Left 0 and BBox Bottom 32 with Precise Collison Checking on and own sprite's color is not invisible and each sprite only has one color.
 

Ommn

Member
The code should working fine
and no need for this:
gravity -= gravity; because gravity = 0; is enough.

but you should reduce gravity because the gravity is acceleration and this value will greatly increase the speed.
 
Top