Physics and its behaviors

2

Attached Files

The following files have been attached to this tutorial:

.capx

physics-demo.capx

Download now 176.54 KB

Stats

1,597 visits, 2,442 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

While back someone asked me if I knew anything about Physics and how to bind the Ball object in the boundary. I do not know much about Physics and its behaviors. Therefore I could not answer back soon. Now I have found a way to do that and here is the little demo. How to bind Ball in square or oblong boundary.

Create new project t and name it as you wish.

Set window size as you wish.

Create Sprite and name it Ball.

Set Ball Collision Mask to Bounding Box

Sprite behavior to Physics

Create another sprite and name it wall.

Sprite wall behavior set Physics also and not SOLID.

Set wall Collision Mask to Bounding Box

Using sprite wall create square or oblong as you like.

sprite wall, Ball behaviors

Your screen might looks like my demo

Set behaviors for both sprite as below

Your screen might looks like my demo

Now open Events and Enter code as BELOW

Not much code but C2 result is best. No other tool can do this with 2 line of codes. Only C2.

Test it. Now use your MOUSE to move around on screen and see the result

.CAPX

physics-demo.capx

Download now 176.54 KB
  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!