![]() ThisĬan be handy if you want to use the bump world as a spatial database in addition to a collision detector (see the "queries section" below for more details).Įach item will have an associated "rectangle" in the world. In fact, you can insert items that don't participate in the collision at all - like puffs of smoke or background tiles. It can be the player character,Ī tile, a missile etc. "Items" are "anything that matters to your collision". World:add is what you need to insert a new item in a world. Basic API - Adding, removing and moving items Requiring the library You will need LÖVE in order to try any of them. There's a more complex demo showing more advanced movement mechanics (i.e. There is a demo showing movement, collision detection and basic slide-based resolution in this branch: prints "Collision with A" for i = 1,len do - If more than one simultaneous collision, they are sorted out by proximity local col = cols ![]() prints "Attempted to move to 0,64, but ended up in 0,-32 due to 1 collisions" if len > 0 then print(( "Attempted to move to 0,64, but ended up in %d,%d due to %d collisions "): format(actualX, actualY, len))Įlse print( "Moved B to 100,100 without collisions ")Įnd - prints the new coordinates of B: 0, -32, 32, 32 print(world: getRect(B)) If it collides with A, "slide over it" local actualX, actualY, cols, len = world: move(B, 0, 64) Local bump = require 'bump ' - The grid cell size can be specified via the initialize method - By default, the cell size is 64 local world = bump.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |