ID:150871
 
Heya, Im looking for a way to implement a timer in the walk cycle, so you dont hold down the cursor and go shooting off into the stratosphere.

The best I can come up with is to set up a sleep comand which makes a 'walk' variable = 1, and then refresh that several times a second.

The problem Im having, is trying to make a way for the player to move, based on weather theres a 1 or a 0 in this walk variable.

Ive already gotten something simmilar working for attacking.. Id just like it a lot more if I could control the walk speed as well.

Thanks in advance.

Elorien
[email protected]
ok if i under stand right...you want it to loop? if so spawn(blahTime) WalkingLoop()
In response to Lord Nova Ice
On 7/13/01 4:20 pm Lord Nova Ice wrote:
ok if i under stand right...you want it to loop? if so spawn(blahTime) WalkingLoop()


Forgive me for another n00b question, but the timer itself isnt the problem. My problem is getting the players character to -move- after the timer has decided that s/he can..

Ive Ive misunderstood, and this is what I need, then can you explain it a little more indepthly? @.@ I just started with byond programming yesterday ^^;; Im trying to get around the main problems Ive had with the games Ive seen up till now.

Thanks again

Elorien
[email protected]
On 7/13/01 4:19 pm Elorien wrote:
Heya, Im looking for a way to implement a timer in the walk cycle, so you dont hold down the cursor and go shooting off into the stratosphere.

What you want to do is override mob/Move().

The best I can come up with <and I am a serious n00b, so bear with me> is to set up a sleep comand which makes a 'walk' variable = 1, and then refresh that several times a second.

This is the right idea. Inside Move(), you should check that walk variable. If it's 1, call ..() which is the parent proc, which will move the player. After that (still under the if), set walk to 0 and then spawn() your desired delay time and set walk back to 1.

So, something like this:

mob
Move()
if (walk)
. = ..()
walk = 0
spawn(delaytime)
walk = 1
else
return 0 // can't move if walk is 0
In response to Elorien
ok now if i understand correctly you want:
a timer to tell weather a mob(player) can move?
now um, i dont know if youve had previous programming skills or not but what you can try is a boolean...or a true false type thing, as far as ive seen byond doesnt specificly have a boolean varible type...but you can do something like this:

proc/CanGo()
if (SomeVarSayingWeatherToGoOrNot == 1) //1 would mean yes
//Go Movement Code

not sure if thats what you need or not, um ill try agian if you want...
In response to Air Mapster
DUDE!
Thats -exactly- what I was looking for

Thank you soooooo much

No more dissapearing into the stratosphere XD

Now I just have to adjust the walk speed of all my npc mobs so they dont swarm me @.@; *LOL*

Thanks sooooo much

Elorien
[email protected]
In response to Air Mapster
Heh... Air Mapster beat me to it...oh well...there you go..i think