Isometric grid based movement scriptAn isometric grid based movement example. Handles collsions and everything |
| Isometric grid based movement script |
//////////////// Isometric grid based movement script //////////////////// // // Copyright Simon Donkers 27-1-2005 // www.simondonkers.com - gmmentor@simondonkers.com // // the arguments are: // argument0 is horizontal grid // argument1 is vertcal grid // argument2 is speed (Use a speed for which both argument0 devided // by this as argument1 devided by this will give an integer number!!! // // This script will generate a correct grid based movement for an isometric game // make sure to use the built in grid with arguments0 and 1 and also make sure // that the character is alligned at the begin // ///////////////////////////////////////////////////// if (argument0/argument2)mod(1)>0 then show_debug_message('Illigal speed used!'); if (argument1/argument2)mod(1)>0 then show_debug_message('Illigal speed used!'); if ((x)mod(argument0)=argument0/2 and (y)mod(argument1)=argument1/2) or ((x)mod(argument0)=0 and (y)mod(argument1)=0) then { speed:=0; image_speed:=0.2; image_single:=0; if keyboard_check(vk_left) and place_free(x-argument0/2,y-argument1/2) then { hspeed:=-2*argument2; vspeed:=-1*argument2; sprite_index:=spr_nw; image_single:=-1; } if keyboard_check(vk_right) and place_free(x+argument0/2,y+argument1/2) then { hspeed:=+2*argument2; vspeed:=+1*argument2; sprite_index:=spr_se; image_single:=-1; } if keyboard_check(vk_up) and place_free(x+argument0/2,y-argument1/2) then { hspeed:=+2*argument2; vspeed:=-1*argument2; sprite_index:=spr_ne; image_single:=-1; } if keyboard_check(vk_down) and place_free(x-argument0/2,y+argument1/2) then { hspeed:=-2*argument2; vspeed:=+1*argument2; sprite_index:=spr_sw; image_single:=-1; } } |
Tip: Have a look at the tutorial How to execute a script
User comments
| PP Anonymous posted at 2005-06-02 01:44:32 | ![]() |
| PP Anonymous posted at 2005-06-03 02:42:19 | ![]() |
| norlick posted at 2006-04-09 11:07:36 | ![]() |
| Simon Donkers posted at 2006-04-09 21:07:13 | ![]() |
| norlick posted at 2006-04-16 16:43:06 | ![]() |
| Nizbene posted at 2006-06-16 05:47:02 | ![]() |
| Simon Donkers posted at 2006-06-16 09:17:07 | ![]() |
| Nizbene posted at 2006-06-18 00:21:04 | ![]() |
| Nizbene posted at 2006-07-20 00:10:50 | ![]() |
| Simon Donkers posted at 2006-07-20 11:47:30 | ![]() |
| Uglyman/Juhkystar posted at 2008-04-27 00:19:14 | ![]() |
| Nusua posted at 2009-03-05 23:42:33 | ![]() |
| Simon Donkers posted at 2009-03-07 15:45:56 | ![]() |
| Zigmas posted at 2009-09-19 19:34:23 | ![]() |
| Zigmas posted at 2009-09-19 19:53:10 | ![]() |
| Hellsoft posted at 2010-01-31 15:59:35 | ![]() |
| MaxExpert94 posted at 2010-06-05 20:45:56 | ![]() |
| Noova posted at 2010-09-02 05:11:34 | ![]() |




is exaclty what I did except for 'what is your name?', creepy...
