Customise movement to repeat until stopped #721
Replies: 3 comments
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022).
Posted: 2020-04-10 08:35:16
User: Scruffy [] (age: 934 days 🙌; posts: 7)
So my latest experiment is making a game similar to the ones years ago, where a character would "slide" from obstacle to obstacle.
So when the player hits a movement key, the character slides in that direction. You can't stop the sliding until the character is stopped by a collision with the wall or a blocked creature.
The combat mechanic is when you hit a creature you push it (and cause damage) unless there is something behind it (it becomes blocked), in which case you just cause damage.
I'm trying to figure out where and how to do this. I saw a collision projection or something somewhere, and trying to work out how to leverage the move controller and/or keyboard controller to a) determine the state to see if he's moving or stationary, and b) how to make him move in the direction pressed.
This works, it's like he's got a jet strapped to him permanently, flying left or right. Collisions with the spritesets with collisions (tiled -> utiliti) do stop him moving, but the Tiled tiles with collisions do not (I don't think they are being imported).
`
```// If moving, keep moving unless blockedif (this.getState() == PlayerState.CONTROLLABLE)
Game.physics().move(Knight.instance(), Knight.instance().getAngle(), 10);}````
Screenshot to visualise. No, that's not a skeleton, it's a Knight in very shiny armour and a skull helmet... #programmerart
[upl-image-preview url=https://forum.litiengine.com/assets/files/2020-04-10/1586507473-758472-knightslide00.png]
Beta Was this translation helpful? Give feedback.
All reactions