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!

[speech_bubble type=”std” subtype=”a” icon=”gordo.png” name=”Gordo” ]Hello Teacher, have you heard about our latest feature – P2 physics?[/speech_bubble]
[speech_bubble type=”std” subtype=”b” icon=”teacher.png” name=”Teacher” ]Hi Gordo, no, I have not…what exactly is it?[/speech_bubble][speech_bubble type=”std” subtype=”a” icon=”gordo.png” name=”Gordo” ]P2 physics is a new game setting in CodeMonkey’s Game Builder. 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’.[/speech_bubble]

[speech_bubble type=”std” subtype=”b” icon=”teacher.png” name=”Teacher” ]What functions become available while using P2 physics?[/speech_bubble][speech_bubble type=”std” subtype=”a” icon=”gordo.png” name=”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. [/speech_bubble]

[speech_bubble type=”std” subtype=”a” icon=”gordo.png” name=”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. [/speech_bubble]

[speech_bubble type=”std” subtype=”a” icon=”gordo.png” name=”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. [/speech_bubble][speech_bubble type=”std” subtype=”b” icon=”teacher.png” name=”Teacher” ]What are the advantages of P2 physics? [/speech_bubble][speech_bubble type=”std” subtype=”a” icon=”gordo.png” name=”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.[/speech_bubble]
[speech_bubble type=”std” subtype=”b” icon=”teacher.png” name=”Teacher” ]Cool, is there a course that teaches users how to create such a game? [/speech_bubble][speech_bubble type=”std” subtype=”a” icon=”gordo.png” name=”Gordo” ]Currently there is not. P2 physics is simply another setting added to GameBuilder that offers students more options for when they create games. [/speech_bubble]
[speech_bubble type=”std” subtype=”b” icon=”teacher.png” name=”Teacher” ]What ages is this for?[/speech_bubble][speech_bubble type=”std” subtype=”a” icon=”gordo.png” name=”Gordo” ]Just like GameBuilder, P2 physics is suitable for ages 12+.[/speech_bubble]
[speech_bubble type=”std” subtype=”b” icon=”teacher.png” name=”Teacher” ]Thank you, I can’t wait to create a game with my students using P2 physics![/speech_bubble][speech_bubble type=”std” subtype=”a” icon=”gordo.png” name=”Gordo” ]Great, be sure to share your games in the comments![/speech_bubble]

Play Space Bananas!

Try CodeMonkey at home or at school!

free trial, credit card not required


for your school / district

More to explore:

what is stem education

What Is STEM Education

Ever heard someone talk about having a career in STEM? In case you have not, STEM is an acronym for science, technology,

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to CodeMonkey's blog

Stay Up To Date on The Latest NEWS