Random Score
natclarke
Brisbane, AustraliaMember, PRO Posts: 243
I have an creature in my game that moves on and off the scene. In that actor I have it set to random images. ie. seal, shark, seahorse (self image etc)
When the hero collides with the creature, I would like it to remove points.
-1, -5, -10, -15 & -20 points?
Can it be coded depending on what creature image appears? i.e. -20 points for a shark, -1 point for a seahorse
I currently have it working with all the creatures losing -5 points and a spawn image of the points lost.
thanks
Natalie
Nat Clarke
Life Cleansing
Comments
How are you randomizing the images? Can you use the same method change the point modifier at the same time?
You can use a table with n rows and 2 columns ( 1st column is the image name(shark), 2nd column = points to be removes (-20) ) .
When you randomly select a row from the table, you change the image and a self attribute (i.e. self.minusPoints ) to the values of the columns.
[ self.image = shark, self.minusPoints = -20 ]
When the creature collides with the hero, subtract from the main score attribute the self.minusPoints.
I haven't tried it...
Hope this works.
http://www.arcaderz.com
If you didn't want to use tables I suppose you could also set up a series of rules that says something like this:
This assumes you have an Attribute named pointValue to keep track of how many points each actor is worth.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Hi @natclarke, make a game integer attribute call it "creature" for example and make it random between your number of creatures. (example 1= shark, 2=seal, 3 =seahorse). Use that attribute in a rule to change image.
Then make a rule, when hero collides with creature AND attribute "creature" is 1 (shark), remove -20 points". Do the same for your others creatures..
I hope that works..
But i think more simply is to make different actors.
Greetings
Nix the Cat: Jump Adventure * Twitter * Facebook
Thanks. I appreciate all the great suggestions.
I ended up going with changing the rules as I had points images showing if the hero collided with the creature.
I went with the easiest road!
Rule 1:
When the Attribute self.Image contains 1
Change Attribute score to score -5 etc
It works great now.
Thanks
Nat Clarke
Life Cleansing
Cool, glad that worked for you.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page