Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
Suppose I have 6 sprites on the screen and they are 2 sprites named "apple", 2 sprites named "orange" and 2 sprites named "cherry". If I have another sprite named "rock" and I drop it on the sprites below, is there a way to detect if it hit the same sprite twice in a row. It would have to reset if it hit an apple first and then an orange. If for example, it hit the orange first and then the other orange, it would do something like play a sound. Thanks much if you can say how.
Have a 'lastHit' global variable and set it to the object's name on collision with that object. Then you can say 'on collision with cherry + global variable = cherry: play sound'. Then as a sub-event 'set global variable to cherry'. Setting the variable needs to be after checking the variable, or else it will always be true obviously.
Hope that helps!
Develop games in your browser. Powerful, performant & highly capable.
1.-use a text instance variable in your items, like: "howManyTimesHaveThisBeenHit".
2.- on first hit, set it to "first",
3.- on second hit, set it to "second"
Thanks guys! Appreciate your input. I haven't been able to make either idea work yet but I'm still working on it. I think I'm getting close though.