Hey C3 world.
In this example, I'm creating the orange "sprite" at a random location. What I want to accomplish next is to click on one of those oranges and add to the orange's instance variable "freckles" (by clicking on the green button). However that is not what is occurring. Somehow the freckles value increases for the first orange I click on and add freckles to but not when I click on other oranges.
Help is very appreciated.
Develop games in your browser. Powerful, performant & highly capable.
Probably you're going off the text? That will always be wrong. The actual logic looks fine though so in debug preview you'll see the values are correct. On the text event you need to pick the orange or it picks the same one.
Hey lionz, thanks for the reply.
I’m not sure what you mean by going off the text. Is there something I need to change with what I have ?
If you're using the text to confirm the values then it will be wrong because you didn't pick an orange. The other logic looks fine though and the actual values are likely fine. When you set text orange.freckles you didn't pick an orange so it will always pick the same one with lowest UID.
Got it. That makes sense. Now, how do I pick without text? That part I can’t grasp
Looks like you need a condition on the left 'pick orange with UID orange_ID' since that is the one you are trying to display the variable freckles. You still need to pick for text because when you say set text to orange.freckles you didn't specify which orange.
Ahhh ok. I thought I did that with the mouse click on orange >> capture the uid // set the orange Id and then the next action was to use that Id. Hmm. Is there an example I can browse? I hate tying you up with these dumb questions.
The orange condition you have at the bottom on the freckles event 'pick instance with UID orange_ID', also add it to the every tick text event.
(Face in palm)
Now it clicks. Geez… my apologies. Thank you for your patience!