Last Signal – Player Movement

One of the gameplay elements that I have worked on for The Last Signal is the players movement.

Astronaut_02

The player moves around the game’s map by engaging the characters thrusters by pressing the A- and D-keys. The A-key engages the left thruster and the D-key engages the right one. This means that the player will turn right when pressing the A-key and vice versa. If both keys are pressed down the character will start accelerating in the direction they are facing and move ahead. If the players releases both buttons, the character will continue to glide in the same direction and with the same speed, until they bump into something, either a wall or enemy, and will bounce and slow down.

The movement in the game is a bit clunky to use and manuvering the map can be challenging for a player not used to the controls. But this is one of the things we are aiming for with the production, to give the feeling of a bulky and heavy suit navigating through a space without gravity.

The first iteration of the movement just had the character traveling in straight lines according to the direction they were facing. There were problems with the player moving around in what looked like random directions, but this was due to the fact that the math used to calculate the characters velocity based on the direction was faulty. I eventually reached the correct method by experimenting until the right one was found.

However this stiff movement that was a reslut of traveling in straight line was not as floaty as we wanted. After some searching around the internet I managed to find a website describing code for an Asteroid game that had movement that was similar to what I was trying to make. After reading through the code presented there and gaining an understanding of what needed to be done, I started using vectors for the characters velocity instead of using different variables and will in the future change other variables in the program into vectors to keep it consistent.

The player now accelerates in the direction the character is facing. If they are facing a direction that is not equal to the one the are facing they will start to curve until they are traveling in the correct direction.

About Anton Classon

2014  Programming