0 Favourites

# How do I Make Falling Dangers

• 7 posts
• Hello, so I am trying to add a danger in my game of a falling spike that falls when the main sprite enters a certain area and will destroy the sprite if it falls on them. Any ideas?

Thanks

• Use sprite coordinates. (I'm assuming this is a side-scroller game) Make an event that says "If player X is equal to Spike X, Spike animation "Fall" plays.

If Spike animation "Fall" is playing and Player collides with Spike, Player is destroyed.

That's the basic logic behind this particular event. Explore the sprite events and you will find the conditions in each one that will allow you to do this. There's never just one way of doing things, you can cause this same effect in many different ways. When you get the basics down you will find different methods that best suits your development logic.

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• "If player X is equal to Spike X ...

That is virtual impossible (with the exception of exact grid movements).

Positions have mostly a (in context to evaluating kinda randomly) fractional part.

So, 'is equal' has no chance.

• I doubt C2 would have the option for "is equal to" if it was not possible to use. It works for me every time. If you have a better alternative then perhaps you should post it.

Anyway, use the advise or not, it's just my 2 cents.

• Thank you both for your advice I will see if it works

• Try the Line-of-sight behavior. With a small cone. Dont forget to place the spikes with theire angle down.

• When dealing with a moving object it is indeed more appropriate to look for a range than a single absolute value, as, unless a precise movement (like a determined grid movement), most of the chances are that your object won't actually reach the exact position you are testing.

By checking for a range, ( Object.X >= end position - 10 & Object.X <= end position + 10) you will always be sure to be able to trigger your end of movement within an appropriate range and can then move your object to the intended ending position.

• 7 posts