Rednaxela wrote:Hoeloe wrote:Rednaxela wrote:Much more generally useful thing you have there.
Though I curse Lua's lack of typing. Getting the same function to work for multiple types was awkward, I had to manually do some checks to determine the type of an object (I believe one of my tests was "does it have a field called "powerup"? Then it's a player").
Though, that type of check does mean it'll seamlessly work with pNPC objects with no fuss, which could be a nice combination for some cases, hah.
Should do. I believe the NPC only makes use of the id, x and y fields, and the mem function.
Onule wrote:Hoeloe wrote:This is useful if you want to override the behaviour SMBX would normally use when these two objects collide
So it would be possible to make a fully working starman?
Also, I think the new version of multipoint on the PGE wiki is missing the library file itself.

Yep. Quite easily, actually. It should be just this (though this will destroy powerups, coins, midpoints, etc. so you may want to filter that):
Code: Select all
function onLoop()
for _,v in pairs(findnpcs(-1,player.section)) do
if(colliders.speedCollide(player,v)) then
v:kill();
end
end
end
Also, oops. That's totally possible. Will rectify momentarily.
EDIT: Done. Should be there now.