This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Renato Castelo
Posted Feb 03 - Read on Facebook

Trying to make a small game and learn Framer at the same time. I need some tips on how to detect collision and trigger an event from it (if spaceship and asteroids overlap)

Anyone willing to help?

6 Comments

Orfeo Chen

I guess you need to load some Javascript lib for physics simulation.

Noam Elbaz

the simple way is: check what x,y position the two objects are in until they are close enough.

Noam Elbaz

once the X or each object and the Y of each object are with a certain range of eachother, trigger the next event... explosion etc in that same X,Y position

Andreas Wahlström

Here's a basic collision detection method: https://gist.github.com/awt2542/c63c285e14ced9773a97dabe946a12b5 It allows you to check if spaceship.isOverlapping(circle)

Orfeo Chen

Agree. To just keep things simple, you can create a bounding box of the spaceship and check if the box collides with something else instead.

Renato Castelo

Thanks guys! I will geek around with the suggestions :)

Read the entire post on Facebook