Question Corner: P2 Physics

Welcome to Question Corner with Teacher & Gordo. In these posts, you will learn useful information regarding CodeMonkey’s different content and courses. Each post will include questions from Teacher with answers from Gordo, Monkey’s smartest friend. Enjoy!

Gordo
Hello Teacher, have you heard about our latest feature – P2 physics?

Teacher
Hi Gordo, no, I have not…what exactly is it?
Gordo
P2 physics is a new game setting in CodeMonkey’s GameBuilder. This setting can be found under the physics manager, which controls how sprites in the game interact with one another. To set your game to P2 physics, click on ‘Create Games’ on your homepage, choose the Game tab on the lower right-hand side of the page, and locate ‘Physics’ under Game Settings. Then, switch the setting from ‘arcade’, which previously was the only available setting, to ‘P2’.

Teacher
What functions become available while using P2 physics?
Gordo
There are a few big changes to take note of when switching the game’s setting from arcade to P2. First, you will see that under the Movement tab, located on the lower left-hand side of the page, ‘step’ and ‘jump’ functions no longer appear. In their place, you will see thrust, rotateLeft, rotateRight, and getVelocity. 

Gordo
The thrust function applies force on a sprite and pushes it forward. To navigate the sprite left and right on the screen use the functions rotateLeft and rotateRight. To use the speed of a sprite in one of the directions x or y, use the function getVelocity. Under the Events Tab, a few functions are added: onCollideWithTilemap, onCollideWithWorldBounds, and onUpdate. 

Gordo
onCollideWithTilemap and onCollideWithWorldBounds can be used to define what happens to the sprite when it collides with the tiles or worldbounds. For example, you can set the sprite to bounce when it touches a tile or for the game to restart when the sprite hits the edges of the game-screen. onUpdate is a function that is called on every frame change. If you want something to happen on each change, implement this function. 
Teacher
What are the advantages of P2 physics? 
Gordo
With P2 physics, students can create more life-like and interesting games. With this setting, students can create a more versatile gaming experience, like the popular game Angry Birds.

Teacher
Cool, is there a course that teaches users how to create such a game?
Gordo
Currently there is not. P2 physics is simply another setting added to GameBuilder that offers students more options for when they create games.

Teacher
What ages is this for?
Gordo
Just like GameBuilder, P2 physics is suitable for ages 12+.

Teacher
Thank you, I can’t wait to create a game with my students using P2 physics!
Gordo
Great, be sure to share your games in the comments!

Animated GIF - Find & Share on GIPHY

Play Space Bananas!

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *