First of all I added the gravitation in the game and followed the sonic game and how I made sonic jump.I applied the same rules for my boy character.In that moment I met a problem,I was not happy how the character is jumping and ask for teacher how I could do it better.He explained that I have to do different from sonic.In sonic I used the change attribute rule while in my own game I created a new attribute-jumping and created a rule which says that then the up keyboard is down it will change attribute linear velocity y to 850 and in the same time it will constrain an attribute self.jumping to true otherwise the change attribute self.jumping is false. And also for jump rule I have made a new rule which changes the image when the character jumps.
I think that now the character is jumping very well.
I attached below he coding that I used for my main character when jumps:
The second thing that I made in game was creating the 'hearts' that the boy will collect.I researched an animated red heart, converted in png and applied in the game. At this point I have created a new rule -the score.That will display text in terms of how many hearts the boy is collecting.
For the heart I created a new attribute that counts and also when the boy collides with the heart ,it is is destroyed. The hearts appear in the scene randomly.I am pleased with the way I have created the hearts .
I did not find any difficulties when creating the coding for the score and the actor''red heart':
1.My first rule consist of the actually animation that is going to be displayed in the scene.
2.The second rule represents the movement of the heart and its role in the game.For this rule I used the y and x position.
3.I used the spawn behavior, the actor is spawning randomly-for that I applied the timer.
4.Next rule represents interacting with the main character.It is playing a sound and it is destroyed when is colliding with ''boy''.
5.The last rule consists of the score. The counter is working and is counting the number of hearts that the boy is collecting.So, when the score is 10=the scene is changing to the next one.
Bellow is attached a video of how the boy is collecting the hearts and how well does the score works:
Now, I am confident in trying different rules,For example how I tried with the jump rule. I know that one rule can be made in different ways. I also improved my Photoshop Skills-I designed the animated red heart in it and also converted it in png.
For my next weak I am planning to create platforms and different obstacles.
No comments:
Post a Comment