LucianL. Posted May 30, 2011 Author Share Posted May 30, 2011 >! Case MOVING_WALKING: MovementSpeed = ((ElapsedTime / 800) * (WALK_SPEED * SIZE_X))PlaySound Sound_Walk Tryed to add an walking sound but the engine read it nonstoply and it get wierd.Is there a way to make it play after a few sec again and the again not continued without pause Link to comment Share on other sites More sharing options...
Helladen Posted May 30, 2011 Share Posted May 30, 2011 Add a timer for the length of the sound. Make it use a constant for the timer and store it and compare it with the GetTickCount. It would like look something around these lines: If GetTickCount > Constant then play the sound. Constant would be set as GetTickCount + (Sound in seconds * 1000) every time it plays a sound. Link to comment Share on other sites More sharing options...
mrmiguu Posted May 30, 2011 Share Posted May 30, 2011 Or call the sound when Player(MyIndex).Moving = 0? No? Link to comment Share on other sites More sharing options...
Helladen Posted May 30, 2011 Share Posted May 30, 2011 No because it would only play when you stopped moving. Link to comment Share on other sites More sharing options...
LucianL. Posted May 30, 2011 Author Share Posted May 30, 2011 @Helladen:> Add a timer for the length of the sound. Make it use a constant for the timer and store it and compare it with the GetTickCount. It would like look something around these lines: If GetTickCount > Constant then play the sound. Constant would be set as GetTickCount + (Sound in seconds * 1000) every time it plays a sound.Here it is and it wont play the song i tryed something like that too.```dim walktime as long`````` walktime = GetTickCount + 2000 If GetTickCount > walktime Then PlaySound Sound_Walk End If```Maybe i'm using it wrong :( Link to comment Share on other sites More sharing options...
LucianL. Posted May 30, 2011 Author Share Posted May 30, 2011 @MrMiguu:> Or call the sound when Player(MyIndex).Moving = 0? No?I tryed something like thisif Player(MyIndex).Moving > 0 thenPlaysound Sound_walkend ifbut it play the sond creazy, something like: it start to play and the next play start over it and the next one over them and it get wierd.I think it is a way to put a pause before the next play start but i don't know how to do it… Link to comment Share on other sites More sharing options...
mrmiguu Posted May 30, 2011 Share Posted May 30, 2011 @Helladen:> No because it would only play when you stopped moving.Just trying to possibly jog your memory of Eclipse's movement code incase you forgot about something like that. I suppose there isn't already a preinstalled variable that is altered after every tile-movement. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted May 30, 2011 Share Posted May 30, 2011 You're setting it to 2000 + GetTickCount and then immediately checking if it's more than GetTickCount. Of course it will be. Set the ticktimer once when the game starts and also when the sound is run. Link to comment Share on other sites More sharing options...
LucianL. Posted May 30, 2011 Author Share Posted May 30, 2011 Can you explain me it a little more? How dose GetTickCount work? :PHehe i think i understand what you told me :``` walktime = GetTickCount If GetTickCount + 300000 > walktime Then PlaySound Sound_ButtonClick End If```It works now and took of a bit of the over loop plays. But now how can i make it to make a pause between one play and another. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted May 30, 2011 Share Posted May 30, 2011 Your logic is still flawed. Now you say: is a number plus 300000 more than that number alone? Of course it is! That makes no sense.```Sub ServerLoop()...Dim walktime As Longwalktime = GetTickCount + #######...Do While ServerOnline...If walktime > GetTickCount Then ' play sound walktime = walktime + ######End If```That's the basic idea. Link to comment Share on other sites More sharing options...
LucianL. Posted May 31, 2011 Author Share Posted May 31, 2011 @Soul:> Your logic is still flawed. Now you say: is a number plus 300000 more than that number alone? Of course it is! That makes no sense.> > ```> Sub ServerLoop()> ...> Dim walktime As Long> walktime = GetTickCount + #######> ...> Do While ServerOnline> ...> If walktime > GetTickCount Then> ' play sound> walktime = walktime + ######> End If> > ```> That's the basic idea.Tryed it and still the same over play :( and if i do it with do while it froze the client.```If Player(index).Moving > 0 Then walktime = GetTickCount + 3000 If walktime > GetTickCount then PlaySound Sound_Walk walktime = walktime + 3000 end ifend if``````walktime = GetTickCount + 3000Do While Player(index).Moving > 0 If walktime > GetTickCount then PlaySound Sound_Walk walktime = walktime + 3000 end ifLoop``` Link to comment Share on other sites More sharing options...
LucianL. Posted June 1, 2011 Author Share Posted June 1, 2011 Come On :( Link to comment Share on other sites More sharing options...
Helladen Posted June 1, 2011 Share Posted June 1, 2011 Try this…```If Player(Index).Moving > 0 Then If walktime = 0 Then walktime = GetTickCount + 3000 If walktime > GetTickCount Then PlaySound Sound_Walk walktime = 0 End IfEnd If``` Link to comment Share on other sites More sharing options...
LucianL. Posted June 2, 2011 Author Share Posted June 2, 2011 @Helladen:> Try this…> ```> If Player(Index).Moving > 0 Then> If walktime = 0 Then walktime = GetTickCount + 3000> > If walktime > GetTickCount Then> PlaySound Sound_Walk> walktime = 0> End If> End If> ```Same it plays it without any pause. I think i will give it up. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now