Player Movement (Week 8 Devlog)


Spearbound Legend

Here is the first public build of Spearbound! (I have decided to drop the "Legend", Spearbound has a nicer ring to it on its own imo). This weeks agenda was to implement a working player movement system, as well as a spear throwing mechanic to get a feel for how gameplay may feel. 

Moving the Player

Coding a basic platforming mechanic was pretty straight forward, the movement script attached to the player would detect when A/D keys were being pressed, and would add force to the player to move it in the corresponding direction. The jump works similarly, with a secondary condition being that the player must be colliding with the ground to be able to jump. Most of the code was resourced from the live-coding lecture on making a basic platformer, however in its current state the player speeds up and slows down at as if it is sliding on ice. This works for many games, but since I want to simulate an older style of game, I altered the code to have a consistent fixed speed and have the player stop immediately when no keys are being pressed.

Aiming the Spear

Once I had the movement feeling how I liked, I began working on the spear aiming mechanic. I made a new spear object and made it follow the players position in the world, to make it look like it was being held by the player. I then added a script that rotates the spear up and down when the W and S keys are held down, giving the player the ability to aim the spear in (almost) any direction. At this point I was tired of looking at blank squares as the player and spear, so I decided to spend the time to create an little animated character using the web application Piskel (piskelapp.com). I think it turned out pretty nicely:

Player throwing and running animations, may need some tweaks but I like how it turned out (throwing animation yet to be implemented in-game)

Once the sprite-sheet imported into the game, I changed the movement code to change the animation states depending on whether the player was running or not, and got the player to mirror its sprite when changing directions. This addition also made it so the spear could also be mirrored to the direction the player is facing.


Player movement: A/D keys to walk left and right, space to jump and W/S keys to rotate spear.

Throwing the Spear

The last step was giving the player the ability to throw their spear. I managed to get this to work by writing a script that disables the follow player and rotate spear scripts, as well as enabling the spear's collider so it could collide with the environment. The final step was adding force to the spear in the current direction it is facing when the E key is pressed. To recollect the spear, if the R key is pressed the follow player and rotate spear scripts were enabled, as well as making sure the spear points in the correct direction when re-collected. I played around with the friction of the object to prevent the spear from continually sliding across the floor and walls, giving it a more realistic feel.

A demonstration of the throwing mechanic.

Spear go slidey

Player Feedback

At this point I uploaded what I had to the discord to get some playtesting and general feedback on the feel of the movement. Overall reception was pretty good, people seemed to like the spear throwing gimmick, however many pointed out some oversights I had made. The first problem was there were some inconsistencies with the movement keys. I had originally programmed the movement to allow both A/D, arrow keys and controller support, however as I continued development I made it exclusively A/D keys. This mainly resulted in lack of animations when moving using arrow keys/controller. Fixing that was just a matter of removing support for alternate controls for the time being (considering the fact that I think multiple players would be fun, I want to leave the arrow keys free for now :D).

Another criticism some people had was that the player would stick to walls when they would run against a wall and jump. All that needed altering to fix this was changing the friction value to zero on the players physics material, resulting in them sliding down.

 

The player no longer sticks to walls when running against it.

One of the most major oversights by me was that the player can add force to the spear even when they aren't holding it. Despite it being a bug, many of the play-testers really enjoyed being able to continually throw the spear around "telepathically", so in the end I made the executive decision to make it a feature! I quickly put together an object that, when collected, gives the player a telepathic spear power-up. I will likely nerf its ability (maybe three throws max), but I'll  plan on making it a collectable powerup when you defeat a powerful telepathic enemy of some sort.

The bug that have become a feature: telepathic spear throws! (now only works when power-up is collected)

Final Stuff

That concludes the game creation segment of this devlog, however when I have had some time free I made a quick mockup of some cover art for the itch page, which can be seen below. I really liked how it turned out, and despite me originally only making it to make my itch dashboard look less ugly, it ended up giving me a good idea of where I wanted the art direction for the game to go.

Cover image art, made both to make my dashboard look nicer, and to get a feel of how I wanted my environment to look

After I had finished making it, I was immediately inspired to create a tilemap for the terrain, using the same aesthetic as the cover art design. I haven't added it into the game just yet as it still needs some tweaking, but overall I think it fits the style pretty well.

Example terrain made using the tilemap I designed based on the cover image art I made

And that's it! Thanks for reading, it has been a really fun process to develop and I can't wait to implement more over the coming few weeks :)

Files

Spearbound (Movement Demo) Play in browser
Apr 21, 2023

Leave a comment

Log in with itch.io to leave a comment.