News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

Maps and Collisions

Started by LairdPleng, January 24, 2008, 08:13:07 AM

Previous topic - Next topic

LairdPleng

I've been browsing these forums for the last couple of days and I stall don't get it :s

I have loaded the map TEST2.FMP which is included with Mappy. I have put the call to initially load the map in a subroutine called loadmap. This was copy and pasted directly from the Testing_16Bit_Mappy_File.pbp file in the Examples\Mappy directory, and this works fine.

At the end of the game loop I draw the map, and layer the sprites (well there's only one sprite at the moment) with the following commands:


DrawMappyLayer Mappy.tMappy,1,%1111,0,0,0
DrawAllSprites
Sync


I have built a function called MovePlayer which deals with handling input from the keyboard and moving the players sprite around.

All this works perfectly but all of a sudden I reach a dead end. Maybe I'm looking in the wrong places, but I can't find any documentation on how to actually test if the sprite is colliding with certain parts of the map! :s

Can anybody help me with this please?

kevin

#1
 LevelHitSprite  (Requires pb1.71 or higher)

 

also,

Collision With maps Ideas


LairdPleng

Thanks for the response Kevin, but I don't have 1.7, and from what I can see from the example for LevelHitSprite it appears to be for 3d maps?

The second link you've pointed me to talks a lot of theory but it doesn't really provide any code which can solve the problem.

Which is that I have my map rendered on screen, but how can I check if my sprite has collided with certain areas on the map? Presumably some of the blocks have some kind of flag which renders the tile as an 'obstacle' (though I couldn't find any mention of this in the Mappy menus)?  If that is indeed the case then I need to know which command I use to check if my players sprite has collided with an obstacle.