|
« Reply #1 on: April 22, 2006, 05:55:21 am »
|
|
This really depends on the walking system your using, but play around with these commands position_empty(x,y) place_free(x,y) collision_point(x,y,obj,prec,notme) collision_rectangle(x1,y1,x2,y2,obj,prec,notme) collision_circle(xc,yc,radius,obj,prec,notme) collision_ellipse(x1,y1,x2,y2,obj,prec,notme) collision_line(x1,y1,x2,y2,obj,prec,notme)
you can set all x's and y's to a relative position such as "x-16" Here is an example code that pretty much says, "If the player is holding down the left arrow key, and the place 3 pixels to his/her sprite is free then move him 3 pixels to the left. This excludes the commands to change animations an such though. if keyboard_check(vk_left) = 1 then { if place_free(obj_player.x-3,obj_player.y) then { obj_player.x -= 3; } }
There are of course countless variations to this code based upon your movement engine. Hope this helps EDIT: In my opinion the GM Help file is the most useful resource for coding. It lists all of the scripting commands, describes them, and gives examples of practical use. If it weren't for the GM help file, I'd still be using rm2k (>_<) So if this doesn't help, I highly suggest you study the help file.
« Last Edit: April 22, 2006, 05:59:23 am by brighteyes »
Logged
|