Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flag system, chaning the .mask tile
#1
So basically this is the concept.

Someone from team A touches a flag on the map. It turns red.

Someone later comes along from team B and the flag turns green.

Later on the flag is touched by someone belonging to no team, and the flag turns gray (neutral).

I have the code done for this using a flag type and an alignment variable in the player type, and a TILE_TYPE_FLAG constant so that the mappers can place flags on certain maps.

My problem is changing the mask tile that the flag is on when it is touched, to correspond with the team color that touched it.

I have the red flag, green flag, and gray flag in the first 3 32x32 spot of the tile set, like so:

[Image: sampleyq4.png]

So I want it to so this. When the flag is nuetral, the .mask image for the tile should be the gray flag, and when someone comes along and touches, say from the red team, it changes the .mask tile to the red flag.

How can I do this? I am very bad when it comes to image work, especially with mirage so any help would be appreciated.

I figured putting some code in the gameloop sub might work the best, using an if statement as such:

Code:
For y = 0 To MAX_MAPY
                For x = 0 To MAX_MAPX
                    With map(GetPlayerMap(MyIndex)).Tile(x, y)
                        If .Type = TILE_TYPE_FLAG Then
                            If GetFlagValue(GetPlayerMap(MyIndex)) = FLAG_NONE Then
                                .Mask = FLAG TILE
                            End If
                        End If
                    End With
                Next x
            Next y

My problem is choosing the right tiles. I don't understand the mapping side of the mirage source as well as I probably should... obviously. So, any help? Or perhaps a better way of doing this?
Reply
#2
That seams to be ok but I think it would be better if you don't change the .mask stuff, becouse there may be a few problems with that. Just right before the bltmask stuff, easy to find in gameloop, add a new blit that blits this thing to the screen. Maybe a maptiletype would be easier.
About the img stuff, I mean you said you don't know it, just take a look at bltplayer and try to blit yhe same way that thing is done.
Good lukc, it seams to be quite fun ^^
Reply
#3
Thanks, I got it working though. Minor bugs here and there but that is to be expected right :p. Works somewhat how I imagined but again not perfect. Maybe I'll throw up a tutorial for tihs after i get it all working right ... since it is kind of fun, and highly competative.
Reply
#4
Looks easy to do. But great concept. I like it
Reply
#5
That would be great, mixed with a guild system, combat arena guild battles with flags would be hilariouse!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)