|
Post by Xenith on Feb 29, 2004 19:31:31 GMT -5
Pretty understandable from the title.So anybody know how?
|
|
|
Post by Antman on Feb 29, 2004 19:47:16 GMT -5
|
|
|
Post by dubos on Mar 1, 2004 21:09:54 GMT -5
anybody know an easier way with more simpler coding? with using the random function?
|
|
|
Post by IsmAvatar on Mar 1, 2004 21:57:21 GMT -5
create event: alarm[0] = room_speed
alarm 0 event:
if random(2) < .5 { speed = 0 } else { direction = floor(random(4)) * 90 speed = 4 }
It sucks, but in order to have an efficient one, there's going to be a lot of code involved.
|
|
|
Post by dubos on Mar 1, 2004 22:17:53 GMT -5
thats what im lookin for but (sorry for asking again i'm not good at coding in game maker0) how would i add to this code for every direction?
|
|
|
Post by IsmAvatar on Mar 2, 2004 15:16:38 GMT -5
all 8 directions?
if random(2) < .5 { speed = 0 } else { direction = floor(random(8)) * 45 speed = 4 }
hey, no problem, i figured someone was gonna ask. And please do register your username for these boards. It's free, and we need more people.
|
|
|
Post by dubos on Mar 2, 2004 18:57:32 GMT -5
sorry what i was actually wondering was how to make him stop and change direction randomly sorry again
|
|
|
Post by IsmAvatar on Mar 2, 2004 21:11:22 GMT -5
I forgot a line of code...
if random(2) < .5 { speed = 0 } else { direction = floor(random(8)) * 45 speed = 4 } alarm[0] = room_speed
but, so that they stop inbetween steps, here you are.
Create event:
alarm[0] = room_speed Alarm 0 event:
if random(2) < .5 { speed = 0 } else { direction = floor(random(8)) * 45 speed = 4 } alarm[1] = room_speed
Alarm 1 event:
speed = 0 alarm[0] = room_speed
As you can see, a long code is inevitable.
|
|
|
Post by dubos on Mar 2, 2004 23:06:10 GMT -5
okay one last thing (hope i'm not too annoying)i'd just like to know how to use random thingie like this
if random 4 = 1 change sprite to walking left x- = 5 if random 4 = 2 change sprite to walikng down y-= 5 and so on
I know i'm not good so sorry.
|
|
|
Post by IsmAvatar on Mar 3, 2004 15:35:50 GMT -5
step event
switch direction { case 0: sprite_index=spr_walk_right;break; case 90: sprite_index=spr_walk_up;break; case 180: sprite_index=spr_walk_left;break; case 270: sprite_index=spr_walk_down;break; }
|
|
|
Post by Xenith on Mar 3, 2004 19:25:06 GMT -5
Wow that all works.One question though how do i make him go to image_single = 0 when he stops?
|
|
|
Post by damiengothic on Mar 4, 2004 10:58:58 GMT -5
try:
if vspeed = 0 { if hspeed = 0 { image_speed = 0 } }
|
|
|
Post by damiengothic on Mar 4, 2004 10:59:50 GMT -5
o yea and put ths on the end:
else { image_speed = 0.3 }
|
|
|
Post by Xenith on Mar 4, 2004 20:33:26 GMT -5
It doesn't work properly with ism avatars ai.
|
|
megabrain
User
Teslagon - Gaming is the first option
Posts: 13
|
Post by megabrain on Mar 5, 2004 10:51:22 GMT -5
if (speed = 0) then {image_speed = 0;} else {image_speed = 1*0.3;(change 0.3 to whatever you want)}
|
|