teleport(spr, newX, newY)
snoglobe opened this issue · comments
This feature proposal includes the following function:
teleport(sprite, new_x, new_y, intoSolids)
The teleport function will teleport a sprite directly to a new location, doing minimal (or none with intoSolids
) checks to if the sprite can reach the desired point.
The intoSolids
parameter is optional, where if it's true
it will not check if the target is a solid, and if it's false
or undefined
(a.k.a. leaving the parameter un-filled), it will check if the target tile contains a solid - and if so, not move the sprite into the new position.
The function will return a boolean to indicate whether it was successful or not. The only failure conditions should be if the new position is out-of-bounds, or if intoSolids
is false and the target tile contains a solid.
This solves the problem of portals (see #1282) not working, as with the current implementation of sprite movement in Spade, we can only move sprites one tile at a time, and cannot "force" a sprite to move to a new location.
I think a better name for this function might be moveSprite
I think a better name for this function might be moveSprite
I disagree. Teleport is better as it intuitively implies that one would avoid normal physics by transporting instantaneously.
sorry shawn i'm on grahams side. pls don't microwave me
I think a better name for this function might be moveSprite
OR make it movesprite with an instantaneous/teleport optional parameter, that'd also be sensible
OR make it movesprite with an instantaneous/teleport optional parameter, that'd also be sensible
currently it does have that with the intoSolids parameter
OR make it movesprite with an instantaneous/teleport optional parameter, that'd also be sensible
currently it does have that with the intoSolids parameter
Ah, missed that detail. Tbh I think it'd be fine to remove the optional parameter, teleport could just simply be teleport. Why make a "weird teleport with weird rules"?
I don't think this adds much advantage over add/remove sprite and if needed can be added as a 3 line utility function by the game author.