|
CheckMapImpact | ||
State = CheckMapImpact(MapIndex, LevelIndex, CurrentXpos, CurrentYpos, NewXpos, NewYpos, Width, Height) | ||
Parameters: MapIndex = The Index of the map you wish to check a level within LevelIndex = The index of the level you with to check collision against CurrentXpos = The Current X (top left) position of this region CurrentYpos = The Current Y (top left) position of this region NewXpos = The new X position (topleft) where this region wants to move to NewYpos = The new Y position (top left) where this region wants to move to Width = The Width fo the region your checking for collision Height = The Height of the region your checking for collision |
||
Returns: State = The collision state of this movement (0 = no collision, 1 = Collision) |
||
The CheckMapImpact function returns if a moving rectangular region has made impact (collides) with a level. If there was collision, the function returns a True (1) value, if not a False (0) value. If an impact does occur, CheckMapImpact will handle the repositioning/ sliding for you. The functions GetMapImpactX and GetMapImpactY will return the new position of the region after sliding To work correctly, CheckMapImpact requires you that to give it, both the position of your object before movement and the position where this object wishes to move to. As well as the width and height of the object. FACTS: * CheckMapImpact Expects the transparent block in the level to be block 0 * Your collision Region can't move longer distances then the levels blocks width/height * Worlds & Sprites can also be used for sliding collision. See CreateWorld, SpriteCollision Mini Tutorial: This example builds map, and level. The primary focus of this example is the detection of collisions of moving region and the level.
This example would output.
|
Related Info: | GetMapImpactBot | GetMapImpactLeft | GetMapImpactRight | GetMapImpactTop | GetMapImpactX | GetMapImpactY : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |