2D World

Blitz3D Forums/Blitz3D Programming/2D World

GIB3D(Posted 2008) [#1]
I'm messing around trying to make a simple 2D side scrolling game. I made the map editor before I made anything else so I didn't have to worry about how my level is setup later. The map editor saves tiles using Types to 3 different layers. Then the actual game loads (right now only layer 1 and 3) the tiles and turns them into 1 big image. Layer 1 for the world, Layer 2 will be for moving objects so it won't be one big image, Layer 3 for Background.

I setting up my player to move around in the world and it works good for just simply moving the player, but colliding not so much. The player can land on floors, but goes through the sides of the world and you goes up through the ceilings.

Right now the only colliding code I have set up is somewhat(not using the actual variable names) like this...
If ImagesCollide(player,playerx,playery,0,worldlayer1,worldx,worldy,0) = 0
u\Vy = u\Vy + .1
    Else
        u\Vy = u\Vy*.4
EndIf


The squares with the green on the 4 corners are Layer3, the background which means I don't collide with those.

My player on the floor/ground walking


My player inside the world


My player's head/eye getting stuck in the ceiling


My player enjoying the world OMG HE'S IN THE GROUND!



The easier route for deciding collisions would be just to use the tiles separately instead of putting them all into one big image but the problem is, it gets laggy and takes forever to exit the game...

Help?


GIB3D(Posted 2008) [#2]
Have no fear! :O Ye need not answer.. if you don't want to. But I have decided i'll try loading the world differently. By just loading the tiles. I think what makes it laggy is the fact that I use "copyimage()" to copy the tileset animimage. This time i'll try just storing the frame number and probably a few other stuff if I need anything else and do it like this

DrawImage TileSet,tile\x,tile\y,tile\frame


Hopefully it will be a lot faster.

Edit:
WOW!
I changed my Map Editor and Game so they don't copy the animation image over and over for each tile and guess what... IT GOES 500000% FASTER! I guess it's best if I just shut up and getta' codin'.