View Single Post
  #29  
06-17-2012, 03:34 AM
Phylum's Avatar
Phylum
No Artificial Colours
 
: Sep 2008
: Rock bottom
: 4,911
Blog Entries: 94
Rep Power: 23
Phylum  (5748)Phylum  (5748)Phylum  (5748)Phylum  (5748)Phylum  (5748)Phylum  (5748)Phylum  (5748)Phylum  (5748)Phylum  (5748)Phylum  (5748)Phylum  (5748)

:
also there's a option for grid_snapped(-,-) which is an if variable but I'll find away to make the player snap to the grid.
It's been a while since I've worked in GM, but here's the equivalent of something I used the other day when I was arsing around with LWJGL.

Put this in End Step, otherwise it won't work.

:
 
this.x += dx;

if (x % GRID_SIZE == 0) {dx = 0;}
Then just set dx in keyboard events. While the object's x isn't a multiple of your grid value it will keep moving in that direction. It should be faster than the GM function, especially if you don't need a vertical grid.
Reply With Quote