Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Walk sound


LucianL.
 Share

Recommended Posts


>! 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

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

@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

@MrMiguu:

> Or call the sound when Player(MyIndex).Moving = 0? No?

I tryed something like this
if Player(MyIndex).Moving > 0 then
Playsound Sound_walk
end if

but 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

@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

Can you explain me it a little more? How dose GetTickCount work? :P

Hehe 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

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.
Link to comment
Share on other sites

@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 if
end if

```
```
walktime = GetTickCount + 3000

Do While Player(index).Moving > 0
        If walktime > GetTickCount then
                PlaySound Sound_Walk
                walktime = walktime + 3000
        end if
Loop

```
Link to comment
Share on other sites

@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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...