Easy way to do this?
Blitz3D Forums/Blitz3D Beginners Area/Easy way to do this?
| ||
Well you know in a RPG when u walk in the back of a house you dont see ur char and when u walk infront part of ur image is over the house, or when u walk under a bridge u dont see ur char how would be the simpless way to draw a char under and image and when its infront on the image? Dunno if you follow me. Oh and how could I make like a invisible square under my char for collision? Thanks in advance be really specific me dumb :P |
| ||
Didn't you already ask something like this before? http://www.blitzbasic.com/Community/posts.php?topic=26560 |
| ||
Yes, but I mean a quick trick, cause i can draw the map as layer 1, layer as houses and after player sprites loads but i got no idea how to set the sprite on or under depending on where it is. dunno maybe a fonction? using blitzplus. |
| ||
easy you have to draw your player sprites beetween the ground layers and the upper layers. for exemple when blitz draw the scene it may draw the whole thing like this [layer 0]ground tiles [layer 1]low objects tiles (such flowers, etc all the stuff the player is above or that can block the player) HERE YOU DRAW THE PLAYER AND ALL MOVING SPRITES [layer 2]upper objects layer 1 the objects the player alway pass under [layer 3]upper objects layer 2 upper than [layer 2] etc... here's a trick use 2 images buffers draw the layer0 and the layer1 on a buffer and the other layers on a second buffer, remember to use the transparent color as background color for the second buffer. then each frames you can - drawblock the ground buffer this erase all graphics on screen - draw the players monster etc - drawimage the upper buffer so you just have to draw all the layers one time then just update the animed sprites positions |
| ||
but if you wana add new players or monster at certain points u have to redraw everything? wouldnt that take long? |
| ||
No, usually not, but of cource you only need to redraw the fields that changes, s'pose this is a simple 2D game. |
| ||
oh like: layer0 layer1 player layer layer3 layer4 only redraw player_layer and layer3 and 4, but if the map is huge :| hopefully it wont take long :S huge means 32x32 blocks X= +10 000 Y= +10 000 :| |
| ||
explain more in details create buffer1 and buffer2 for example: buffer1=createimage(graphicswidth(),graphicsheight()) buffer2=createimage(graphicswidth(),graphicsheight()) (note that you MUST use the transparent color of your tileset as background color of the buffer2) the you draw your map layers in these buffers layer 0 and 1 in buffer1 layer 2 and 3 in buffer2 so your main loop can look like this repeat drawblock buffer1,0,0 *** draw the player *** drawimage buffer2,0,0 flip until keydown(1) so no need to redraw the map from the data each frame :) |
| ||
No, only redraw the block from where you moved, and the block to where you moved. Alternately, redraw the whole screen every time the player moves, it should be possible. But only the visible part of course. You don't use some fancy B+ function to keep track of the map, cause then you should probably seek help from someone who own B+, at least if what I said can't help you. |