Windows collision check not working

G

gekidoshi

Guest
ok so my guy goes right through the walls

the code is

GML:
if (place_meeting(x, y, obj_Ground)) hspeed = 0
I also tried
Code:
if !place_meeting(x, y + 1, obj_Ground)
   {
   gravity = 0.01;
   }
else
   {
   gravity = 0;
   }
but that also doesn't work
 
If your gravity is pulling it down you are going to want to stop it with vspeed = 0 instead. Setting gravity to 0 just sets how much it accelerates per step. It doesn't actually stop it.
 
G

gekidoshi

Guest
If your gravity is pulling it down you are going to want to stop it with vspeed = 0 instead. Setting gravity to 0 just sets how much it accelerates per step. It doesn't actually stop it.
still does not work
 
G

gekidoshi

Guest
Can you post your code?
GML:
var lkey = keyboard_check_pressed(ord("A"))
var rkey = keyboard_check_pressed(ord("D"))
var ukey = keyboard_check_pressed(ord(" "))
var nkey = keyboard_check(vk_nokey)

///gravidade e colisoes
if !place_meeting(x, y + 1, obj_Ground)
   {
   gravity = 0.01;
   }
else
   {
   gravity = 0;
   vspeed = 0;
   }
///movimento
if lkey
   {hspeed = -5;}
if rkey
   {hspeed = 5;}
if nkey
   {hspeed = 0;}
 
For both sprites involved are the collision masks set up correctly? And are they both somewhat thick to prevent passing through.
 
Top