How to add points to score when actor collides with another?
GoodnightMoon
Member Posts: 23
So, with some help, I've set up an endless scoring system on a runner game where the further you rise vertically, the more points you get. However, I've added in stars to collect that I ideally want to add +5 points onto the score when you hit them. So I've tried the obvious i.e. adding a rule when an actor collides with "gold star" and adding an attribute that game.Score+5 however it's not working?
Keep in mind I've VERY new to all of this so I'm not sure if what I'm doing is right or wrong and ANY help would be greatly appreciated,
Thank you!
Comments
It would help to see your rules but it sounds like you're on the right track. Make sure your rule for collision looks like this:
When 'player' overlaps or collides with 'star'
Change Attribute game.Score to game.Score+5
Make sure you're choosing game.Score from the Attributes browser and not typing it in by hand.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Hi Jamie,
Firstly, thank you for getting back to me so quickly! Oh phew, I thought I was doing something wrong, but I actually got it working with what you said. Don't know what on earth I was doing wrong haha
Thanks again
If you have a game where more than one star can collide with the player actor at a time, make sure the collision rule is in the star actor instead of the player actor.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@GoodnightMoon, you're welcome. Glad it helped.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page