Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Something like CTF
#1
Hi all,
Does someone know how i can make sometething like this:
A class that hits a flag on a map will change the flag to the color(changing sprite to blue flag) blue for example.
I'm a beginner in coding VB6 so if people want to give me hints or just help me a bit I would be thankfull. A tutorial would be nice but i can't ask that much.
#2
Dave Wrote:You'd probably want to make a flag attribute (similar to block) that can take the value of anyone hitting it. Then just say, "if it's this value, it's this color draw this picture"
Thanks for helping but like i said i am a beginner in VB6 and a beginner already knows these things: The problem is which variable must i use where must i put the codes.
#3
Just name it like.. CTF

Or.. Flag
#4
Dave told you what to do, and since he told you what to do, using code that's already in the source, you add the stuff right there. It's really simple, and Dave told you everything you need to know.

The variable or w/e, would be like tile_type_flag.. Something along those lines. Just like the block tile.
#5
Dave Wrote:Follow the other attribute code, copying an attribute (like block) and modify the stuff to act as a flag.

That's the thing with Mirage Source, a lot of the code is already there to copy.
Okay i requested a tutrial and i get some answer that i already know well let say what i understand and what i need to learn okay:
I know how to create the TILE_TYPE_FLAG and all the stuff that comes with it i already did it.
The problem will come now: I don't know the code how to make TILE_TYPE_XXX a tile sprite.
PS. answer in codes and not in normal languages and letting me translate it to codes.
#6
Dave Wrote:Put all of this in modThinkAboutIt

If AddBltFlagsToGameLoop = true then
Goto NextStep
End If
Exit Sub

NextStep:
For each flag in Map
CreateRects
Blt
Next
Okay still not understanding what are you trying to do the only thing yopur doing is getting me confused morethen i already am. Okay using the blt things is right but what after this how to open tile1.bmp and set this sprite and if it hits player change it to another sprite.
#7
He's telling you the basic structure of the code.

And the code is doubling as a suggestion to "just think about it".

Go brood over what we've told you and come to the answers on your own.

People rarely want to create a tutorial for someone when they aren't going to use the code themselves.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
#8
precrid Wrote:
Dave Wrote:Put all of this in modThinkAboutIt

If AddBltFlagsToGameLoop = true then
Goto NextStep
End If
Exit Sub

NextStep:
For each flag in Map
CreateRects
Blt
Next
Okay still not understanding what are you trying to do the only thing yopur doing is getting me confused morethen i already am. Okay using the blt things is right but what after this how to open tile1.bmp and set this sprite and if it hits player change it to another sprite.

Dude.. It's really simple to add. We're not just going to hand you the code. You need to learn to do something on your own. And this is super easy. You say you understand how to do something, but yet you don't. You define the tile type, then where it checks all the other tile types, add a check for the new tile type, and if it is that type, then make it execute the code and what not.

Just copy the rest of the stuff. You'll understand better.
#9
Okay i think your thinking im sitting here and only let other people work for me i really try but its not workinh i did these things:
Added at ' Tile consants
#10
Dave Wrote:If you're using a seperate picture file for flags, you'll need to load them into a surface the same way the other graphics are in modDirectX.

To make it switch, you'll just do something like, "If player.x = flag.x And player.y = flag.y then..."
And to change color, you could just have to flag colors and do flag.color = 2
LOL this is the first answer that i understand the first answer that shows me where to search thanks.
So you mean something like this.
Code:
' Init flags ddsd type and load the bitmap
    DDSD_flag.lFlags = DDSD_CAPS
    DDSD_flag.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN Or DDSCAPS_SYSTEMMEMORY
    Set DD_flagSurf = DD.CreateSurfaceFromFile(App.Path & "\GFX\fn.bmp", DDSD_Flag)
    SetMaskColorFromPixel DD_ItemSurf, 0, 0

fn.bmp contains 3 flag sprites they are all 32x32 so the total size is 32 height and 96 width.
one flag is gray(no team) another flag is red and another one is blue. Another question i got is: must "DDSD_flag.lFlags ,DDSD_flag.ddsCaps.lCaps ,DD_flagSurf" must all words that are red be flag or tile??

player must be class for example class 1 is team 1 class 2 is team 2 for example
#11
He's only told you where new surfaces are created.

If you don't even know that, I doubt you'll be able to get the main code done for the system.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
#12
Robin Wrote:He's only told you where new surfaces are created.

If you don't even know that, I doubt you'll be able to get the main code done for the system.
Okay i don't know anythign im so dumb that even a baby is smarter etc etc etc are you happy now are you ready to tell me some usefull stuff then only cracking me off. I really get tired of those reactions. I know i have to learn but you can't learn if you don't know.
#13
Okay i think i need this code to change flag sprite
Code:
If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Type = TILE_TYPE_FLAG Then
        If GetPlayerClass(1) (here must the sprite code that i don't know)
End If
    If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Type = TILE_TYPE_FLAG Then
        If GetPlayerClass(1) (here must the sprite code that i don't know)
End If

This code could be ofcourse fault well im sure that its fault but i tried.
#14
I believe it's something like this:

Code:
If Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Type = TILE_TYPE_FLAG Then
        If GetPlayerClass(MyIndex) = 0 Then
             Map(GetPlayerMap(Index)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Anim = Class0Flag
        End If
        If GetPlayerClass(MyIndex) = 1 Then
             Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Anim = Class1Flag
        End If
End If

Now, where I have Class0Flag and Class1Flag, you need to count how many tiles your flag is in your tile set. So if Class 0 Flag was the 3rd tile, in the second row, Class0Flag should be replaced with the number 9.

Code:
0123456
789----
-------
#15
Sonire Wrote:I believe it's something like this:

Code:
If Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Type = TILE_TYPE_FLAG Then
        If GetPlayerClass(MyIndex) = 0 Then
             Map(GetPlayerMap(Index)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Anim = Class0Flag
        End If
        If GetPlayerClass(MyIndex) = 1 Then
             Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Anim = Class1Flag
        End If
End If

Now, where I have Class0Flag and Class1Flag, you need to count how many tiles your flag is in your tile set. So if Class 0 Flag was the 3rd tile, in the second row, Class0Flag should be replaced with the number 9.

Code:
0123456
789----
-------

sorry but i do not understnad the last code.
Code:
0123456
789
A normal tileset got 8 tiles a row so for example if the flag is on the 8th tile of the first row this wouldn't work? right.
And how does the computer knows the height and the width of each tile.
And at last where must i add his code??
#16
You're both wrong, it's 7.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
#17
Yes, but I didn't say it was only 6 tiles across. I was just demonstrating how the tiles are numbered. And I'm pretty sure it starts with 0, not 1.

Precrid, that second bit of code wasn't code. It was just a demonstration of tile order. That code probably wont work 100%, as it was just a suggestion, and not actually tried. However, if it did work I'd probably put it in bltTile.
#18
Sonire Wrote:Yes, but I didn't say it was only 6 tiles across. I was just demonstrating how the tiles are numbered. And I'm pretty sure it starts with 0, not 1.

Precrid, that second bit of code wasn't code. It was just a demonstration of tile order. That code probably wont work 100%, as it was just a suggestion, and not actually tried. However, if it did work I'd probably put it in bltTile.
Okay that code would not help could you post a code that could help please.
#19
precrid Wrote:I'm a beginner in coding VB6 so if people want to give me hints or just help me a bit I would be thankfull. A tutorial would be nice but i can't ask that much.

The code I posted will probably work if you put it in Sub bltTile, which is in modGameLogic. That is of course assuming that your flags are in your tile set. Did you try the code at all? Or just assume that it wouldn't work because it's untested?
#20
Sonire Wrote:
precrid Wrote:I'm a beginner in coding VB6 so if people want to give me hints or just help me a bit I would be thankfull. A tutorial would be nice but i can't ask that much.

The code I posted will probably work if you put it in Sub bltTile, which is in modGameLogic. That is of course assuming that your flags are in your tile set. Did you try the code at all? Or just assume that it wouldn't work because it's untested?
No am going to try but i couldn't try because i did not knew where to put the code.
But after you said it was just a suggestion and that it wouldn't work probaly I did not tried either. But thanks man.
#21
Perfekt Wrote:
precrid Wrote:
Dave Wrote:Put all of this in modThinkAboutIt

If AddBltFlagsToGameLoop = true then
Goto NextStep
End If
Exit Sub

NextStep:
For each flag in Map
CreateRects
Blt
Next
Okay still not understanding what are you trying to do the only thing yopur doing is getting me confused morethen i already am. Okay using the blt things is right but what after this how to open tile1.bmp and set this sprite and if it hits player change it to another sprite.

Dude.. It's really simple to add. We're not just going to hand you the code. You need to learn to do something on your own. And this is super easy. You say you understand how to do something, but yet you don't. You define the tile type, then where it checks all the other tile types, add a check for the new tile type, and if it is that type, then make it execute the code and what not.

Just copy the rest of the stuff. You'll understand better.

Dave Wrote:The reason we're trying to help you is because we want you to get it working, but we're getting to the point where we're writing it for you.

It's hard for us to give code on a feature that is unique like this one, because we don't have the code available to us.
That means we either need to add the feature to a blank MS and see what we need to do, which is a lot of time and effort that we'd rather spend elsewhere, or make up some code on the spot that probably wont work.

I'm sure you can see the problem with each method.

As for drawing the flags, look at the way Tiles are drawn. There's rec, and rec_pos. Those are both rectangles saying the source and destination. You just need to use the correct source rect to pick which color flag you draw. It measures in pixels so it should be easy to figure them out. Useful constants are PIC_X, PIC_Y (which are both = 32 = Tile Size)

Pretty much copying most of the code from BltTile.

Are this a pro-pro vb6 opinion against eachother or a beginner-pro?
#22
Dave is better than me. That's all I'm going to say.

I'm not a beginner though.
#23
I think he was pointing out that Dave said "Hard" and you said "Easy".

If he was, then Dave was saying it's hard for us to give code, not that it was something hard to program.

We could add this code in 10 minutes or so, but we're not going to add the code to our sources to test it out, then right a tutorial for you because we don't want a feature like this ourselves.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
#24
Robin Wrote:I think he was pointing out that Dave said "Hard" and you said "Easy".

If he was, then Dave was saying it's hard for us to give code, not that it was something hard to program.

We could add this code in 10 minutes or so, but we're not going to add the code to our sources to test it out, then right a tutorial for you because we don't want a feature like this ourselves.
It's hard for us to give code on a feature that is unique like this one, because we don't have the code available to us. That means we either need to add the feature to a blank MS and see what we need to do, which is a lot of time and effort that we'd rather spend elsewhere, or make up some code on the spot that probably wont work.
He means it will take a lot of time for him or other people to make a tutorial for me.
If something takes a lot of time then its hard anyway I don't know why a moderator would say such a thing its a REQUEST TUTORIAL FORUM so if you don't wanna help my request and tell me stories about how easy or hard it is then this ain't the right place. I guess i have to be a moderator.
#25
He was giving you suggestions on how to get started on making your own system instead of waiting for someone else to release theirs (which he probably feels that you could've been waiting for a long time). Capture The Flag is a type of addition that is purely-game dependent. It is not likely that someone will add a large, fully completed, detailed system to their game and then even write a tutorial.

The request is made, the suggestions were given; this topic has served its purpose. Locked.
Hopefully someone will come across this topic and write a tutorial for you. =)


Forum Jump:


Users browsing this thread: 1 Guest(s)