On this page, you can read all about my personal contribution to the code of the game '3D Traffic Racer'.
My name is Natasha Swart. Before I started my minor with subjects of Cognitive Science and Artificial Intelligence, I had never coded before in my life. As you can see I have learned a lot in the last five months. I enjoyed it thoroughly.
The first thing I altered was the point system. We wanted the high score to start at 0, so you could build up your own high score. The score itself was measured by the speed of the car. We did not want this; we added hearts and crosses to form a new point system. I simply altered the code on the sprite "Figur1" so that the speed no longer defined the score and the highscore was set to 0 whenever the game was started. It looked somewhat like this:
set score1filter to 0
set score to 0
set Highscore to 0
wait 1 sec.
And we had a working point system with personal highscores!
Speed and score
The next thing I did, is still related to the speed and point system. A heart will give you 3 points and will change the speed by -3 (meaning the speed increases by 3). A cross will not give nor subtract any points, but it will change the speed by +2 (meaning the speed decreases by 2). The code for the hearts that I altered looked a bit like this:
if touching You then
change score by 3
change Fasaudo by -3.
I noticed that the arrow keys had influence on the speed as well, but I did not like this, because it gave the user too much control and made the game unnecessarily easy or difficult. I deleted this feature.
It will now be very tempting to collect hearts, because the score will go up, but as the speed increases it will become harder and harder to do so. To solve this problem, you can collect crosses to decrease you speed somewhat. As this will not alter your score, it’s still possible to receive a high score with this game.
At first, we gave the crosses too much influence on the speed. I once tried to only hit crosses and no hearts, which ultimately resulted in me going backwards. It was hilarious, but not the way we wanted it to be. I changed the crosses' influence and checked and altered the minimum speed.
Collaboration with Timo
The idea for the soundtrack 'Hit the road Jack' was mine, but I'll give Timo full credit for installing it into the game.
On the 29th of May, Timo and I worked together to respond to the feedback we received earlier. We wanted the side arrow keys to respond to the user, but weren't sure how we could do that. I thought maybe we could make the game respond to the user whenever he/she stays in the utter left or right lane for a longer period of time. Timo decided that we should increase the speed whenever this happened. If you move to the utmost left or right lane and you are still there 3 seconds later, the speed will change by -2 (meaning the speed will increase by 2) and an exclamation mark will show itself in the middle of the game. We tried to give the utmost left and right lines a slight red hue, to indicate that these lanes to stay on for very long, but we did not like the way it looked, so we decided not to do this. The code for the new exclamation sprite looks like this:
I believe we are done with the game now, but I will certainly brainstorm on additional features. Any way we might go from now, I am exceptionally proud of my team members and I am very content with the game we developed.