Collision Events


Image result for pizza pixel art background

The princess seems pretty hungry, she would like to eat a couple of slices of pizza. The main objective of any new assignment, is to understand how sprites collide with each other and give it a certain reaction at the moment they make contact. I must follow the “Princess Pizza” tutorial and afterwards, add more features into  my project.




What is the purpose of the overlapping event?

In my project, the purpose of the overlapping event is to create a reaction to the “pizza sprite of a kind food”. As soon as the princess (prite of a kind player) makes contact with the pizza, it will be eaten (destroyed) and set the score by 1. The sprite will appear again on a different location from the initial one and it would start to move at a certain velocity. 




What are some of the default types of sprites?

The program already has a few types of sprites that are most commonly used such as: player, food, enemy and projectile. But you can add more if you wish, it depends on what you want to use it for. In my case, I used the “player” which was the princess and “food” which was the pizza.



What challenges did I encounter?

I didn’t encounter any challenges during the tutorial, but after I finish making my mod of the tutorial, I wanted to add another sprite for the princess to eat. I added a burger with the same function as the pizza but the only difference was that it moved at a different location. The problem I had with the sprite that was added, was that each time the burger was eaten, it appeared again but double the amount at a point that there was a bunch of burgers all over the screen. I tried to fix this problem but I just couldn’t find where was the main fallacy so I kept it how I initially planned to mod my project.



What did I do to modify my code?

I added motion to the pizza to make things more challenging. I also added tiles set as walls so that they could be obstacles for the player to move around. I set the pizza to move randomly at a constant velocity and to bounce against the walls each time it made contact with it. Oh and I almost forgot, the princess has a little speed bubble at the start of the game.



Overall

I practiced my skills with makecode, learned new things, played around they the coding process and I felt very satisfied with the final product.


Comments