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

[EO]2.0 T-7500 tiles animation system


t7500
 Share

Recommended Posts

HI

I've created a new system for tiles animation for my project. Also the same way created a 4 seasons. Brutal way, but simple

Reserve 4 tilesets to make animation frames (in that case 11.bmp - 14.bmp) 4 different state of water

**ALL IN CLIENT SIDE**

create new timer and name it "Tileanimate"
set interval to 500

```
Private Sub Tileanimate_Timer()
tanim = tanim + 1
If tanim = 4 Then tanim = 0
End Sub

```
**In ModGlobals add:**
```
Public tanim As Integer

```
**In modDirectDraw7**
in BltMapTile

**add**
```
Dim ani As Integer

```
**before:**
```
Call Engine_BltFast(ConvertMapX(x * PIC_X), ConvertMapY(y * PIC_Y), DDS_Tileset(.Layer(i).tileset), rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)

```
**add**

```
'------------------------ANIMACJA WODY----------------
        For ani = 0 To 4
    Select Case tanim
    Case 1
    If Map.Tile(x, y).Layer(ani).tileset = 11 Then Map.Tile(x, y).Layer(ani).tileset = 12
    Case 2
    If Map.Tile(x, y).Layer(ani).tileset = 12 Then Map.Tile(x, y).Layer(ani).tileset = 13
    Case 3
    If Map.Tile(x, y).Layer(ani).tileset = 13 Then Map.Tile(x, y).Layer(ani).tileset = 14
    Case 0
    If Map.Tile(x, y).Layer(ani).tileset = 14 Then Map.Tile(x, y).Layer(ani).tileset = 11
    End Select
    Next
      '------------------------------------------------------

```
That should work

Known bugs:
when new map loaded, first 4 frames of animated tiles can blit with black colour, maybe the preload of tilesets may help.
Link to comment
Share on other sites

It is basic but fast and almost no CPU usage, but little more RAM

Like Growlith1223 wrote
@Growlith1223:

> tiles have to be in the same slot…
> Like if you select the first tile in the 11th tileset, does the other tiles have to be on the same slot but on the other tilesets...

Here is example of my animation tilesets 11-14 - in each different water phase
![](http://img3.imageshack.us/img3/9919/67809688.png) ![](http://img338.imageshack.us/img338/8165/64629884.png) ![](http://img4.imageshack.us/img4/4702/67504099.png) ![](http://img689.imageshack.us/img689/7384/64784624.png)
Link to comment
Share on other sites

  • 2 weeks later...
anyone managed to fix the black tiles appearing…. 
EDIT:
ok so i have found a fix but i dont know if it would cause problems someone more experienced would have to tell me off but seams to be working...

In HandleCheckForMap
In the section
```
    ' Either the revisions didn't match or we dont have the map, so we need it
    Set Buffer = New clsBuffer
    Buffer.WriteLong CNeedMap
    Buffer.WriteLong NeedMap
    SendData Buffer.ToArray()
    Set Buffer = Nothing

```i added Buffer.WriteLong 1
so it now reads
```
    ' Either the revisions didn't match or we dont have the map, so we need it
    Set Buffer = New clsBuffer
    Buffer.WriteLong CNeedMap
    Buffer.WriteLong 1
    Buffer.WriteLong NeedMap
    SendData Buffer.ToArray()
    Set Buffer = Nothing

```
Anyone know if this will cause any issues? because it seams to have fixed the black tiles.
oh and I didnt like adding a timer so i have my tmr100 doing this
```
            ' Update inv animation
            If NumItems > 0 Then
                If tmr100 < Tick Then
                        tanim = tanim + 1
                        If tanim = 4 Then tanim = 0
                    BltAnimatedInvItems
                    tmr100 = Tick + 100
                End If
            End If

```instead of just
```
            ' Update inv animation
            If NumItems > 0 Then
                If tmr100 < Tick Then
                    BltAnimatedInvItems
                    tmr100 = Tick + 100
                End If
            End If

```If someone could try this out / knows if it'll cause issues im sure im not the only one who'd love to know. ;)

edit: after further testing only works for room 1…
Link to comment
Share on other sites

If you use tmr100 timer it can skip some animation, even stop (when too much details on the map makes lag)
tanim can get value more than 4  and continuosly rising. It is more safe to make in tmr100 variable from:

If tanim = 4 Then tanim = 0
to
If tanim >= 4 Then tanim = 0

–---------------------------------
For blitting black tiles:

Buffer.WriteLong 1 didn't changed too much - I've attached 9 map in 1 (my developing system) as big continuosly world so in this case it's not working.

Technically i've make copy one of animated tile in regular tileset. - As ground painted static water and as mask1 used animated tile - this sort of masking bug is temporary fix but helpful.
Link to comment
Share on other sites

  • 4 weeks later...
@Mortal:

> But where ?

Don't do it… look at the two posts above you.. The Client already loops on idle.. put your timer there in form of a clock counter.. it's much better than an extra timer.

@t7500 if you're still around here: please update your first post...
Link to comment
Share on other sites

Thanks..
But i see now, then i can only have 1 Animation or not ?
Because there is that :```
'------------------------ANIMACJA WODY----------------
        For ani = 0 To 4
    Select Case tanim
    Case 1
    If Map.Tile(x, y).Layer(ani).tileset = 11 Then Map.Tile(x, y).Layer(ani).tileset = 12
    Case 2
    If Map.Tile(x, y).Layer(ani).tileset = 12 Then Map.Tile(x, y).Layer(ani).tileset = 13
    Case 3
    If Map.Tile(x, y).Layer(ani).tileset = 13 Then Map.Tile(x, y).Layer(ani).tileset = 14
    Case 0
    If Map.Tile(x, y).Layer(ani).tileset = 14 Then Map.Tile(x, y).Layer(ani).tileset = 11
    End Select
    Next
      '------------------------------------------------------
```
Link to comment
Share on other sites

No.. you can animate every tile with that but only from tileset 11 to 14.. what a … well.. not a good option..
you should add some layers and show and hide them ... or better use something different..
Well it's your choice. This system should work, but you have to animate over 4 tilesets.. (11-14).
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...