*NEW* Current Version on STEAM: 16.793Webchat:Visit the chat
Quotesprcoll ([id_of_player], x_of_player, y_of_player, [id_of_terrain_sprite, x_of_player, y_of_player]))
SPRCOLL (player_id, player_x, player_y, terrain_id, terrain_x, terrain_y)
Quote from: Slydog on 2010-Jul-30Quotesprcoll ([id_of_player], x_of_player, y_of_player, [id_of_terrain_sprite, x_of_player, y_of_player]))Did you type that wrong, or did you mean for the 2nd 'x_of_player', 'y_of_player' to refer to the terrain, such as:Code (glbasic) Select ExpandSPRCOLL (player_id, player_x, player_y, terrain_id, terrain_x, terrain_y)That should work.
Quote from: Slydog on 2010-Jul-30That SPRCOLL check is saying:"Will the player sprite, if it was at (x,y) collide with a terrain sprite if it was also at (x,y)"That should always return true, since with that check both sprites would always be overlapping.Sprites don't really exist/persist anywhere, think of them more as a BitBlt (blit) function.Ie, to display them you just tell GLBasic to copy the bitmap to the screen at a certain location.After that, the sprite doesn't exist at that position.So, in general, the SPRCOLL check is asking:"If I were to place sprite 1 at position x1, y1, would it collide with sprite 2 if I positioned it at x2, y2?"So, you would need 25 SPRCOLL checks if you have 25 different terrain tiles.If the terrain is in a tile map, a simple nested for loop (row, column) could be set up to check if the player would be colliding with each terrain tile.