Well i borrowed one ped from GTA2. Created a sprite sheet.
Now i have one ped animation in BMP file.
Total of 9 frames. Walking and standing.
DPPro animates it fine. And now today i was trying to attach it to some plain. One idea i had that i would position the sprite at the same position where the plain is. So it's like plain is always under the ped and if plain collides with something then the ped also stops.
But this was rather a quick hack, i didn't tried to make it better and it was very buggy.
So at the moment i have animated ped sprite. Nothing else.
About that grid system. Very good, i just was thinking about how i will control them.
GTA2 map has flags of cube type on each cube. Like: pavement, water, air, field, road.
And hidden arrows on road for vehicles.
Vehicles are detecting the arrows directions and driving that way.
But it's too early talk about the vehicles.
I must get peds walking around first.
I found also one snippet here:
http://forum.thegamecreators.com/?m=forum_view&t=105132&b=1
EDIT: Thanks to that snippet i managed to texture plain with one tile from my tilesheet.
Let's see if i can animate it.
Will edit this post or post a new one.
I must make code snippet how to animate plain if get this working.
I see that this is requested alot but almost no answers.
EDIT2: I got animating to work.
`======================================================
`Plain texture animation
`Created: 13.09.2009 by Mulderman (A.V)
`Credits and many thanks goes to:
` 1) dark coder for SetObjectSpriteFrame
` 2) Grog Grueslayer for timing code
` 3) Van-B for motivation
` 4) Grand Theft Auto 2
`======================================================
sync on: sync rate 60
`Load spritesheet
`Change this bmp file and it's path to your own values!
load image "xped.bmp", 2
`Create animation from it
`Change this bmp file and it's path to your own values!
create animated sprite 1, "xped.bmp", 9, 1, 1
`Make simple and small plain
make object plain 1, 0.2, 0.2
`Texture our plain with the spritesheet
texture object 1, 2
`Current image frame
global Frame = 1
` Set a timer for frame switching
time = timer()
`Make our plain transparent
set object transparency 1, 2
`Main loop
do
`Uncomment these 2 lines to see sprite animation at X 40, Y 80
`play sprite 1, 2, 9, 190
`sprite 1, 40, 80, 1
`Check if 190 milliseconds is past
if timer() > time + 190
`Change to the next frame number
inc Frame
`Check if the frames are within 1 to 9
if Frame = 9 then Frame = 1
`Show the frame switch
`Reset timer
time = timer()
endif
`This does the hard work, thanks goes to "dark coder"
`http://forum.thegamecreators.com/?m=forum_view&t=105132&b=1
SetObjectSpriteFrame( 1 , Frame , 9, 1)
`Display FPS and current frame
text 40,40, "FPS "+str$(screen fps())
text 40,60, "Switch to Frame "+str$(Frame)
`Update
sync
loop
`Free the resources
delete image 1
delete object 1
`End of program
end
` ###########################################################
` ###########################################################
` http://forum.thegamecreators.com/?m=forum_view&t=105132&b=1
` ###########################################################
` ###########################################################
Function SetObjectSpriteFrame( Object As Dword , Tile As Integer , SpriteX As Float , SpriteY As Float )
Local ShiftX As Float
Local ShiftY As Float
Local U As Float
Local V As Float
Local Across As Integer
ShiftX = 1 / SpriteX
ShiftY = 1 / SpriteY
If Tile
Across = Int ( Tile / SpriteX )
V = ShiftY * Across
U = Tile MOD SpriteX
U = U * ShiftX
Else
U = 0
V = 0
Endif
Lock VertexData For Limb Object , 0
Set VertexData UV 0 , U + ShiftX , V
Set VertexData UV 1 , U , V
Set VertexData UV 2 , U + ShiftX , V + ShiftY
Set VertexData UV 3 , U , V
Set VertexData UV 4 , U , V + ShiftY
Set VertexData UV 5 , U + ShiftX , V + ShiftY
Unlock VertexData
EndFunction
All comments, suggestions about improving this stuff, etc. are welcome.