Is there a way to associate an image to an attribute?
knedy
Member Posts: 7
I want to display an image in front of a table value holding the score.
Is there any way to achieve this?
Thanks!
Is there any way to achieve this?
Thanks!
Comments
It sounds like you're trying to do something like a custom score font. If so, there are tutorial videos available for that, but the basic idea is to save each digit as "1.png", "2.png", etc. and then do Change Attribute self.image to game.digit, assuming game.digit is the correct value.
If you're wanting a different image to appear based on the score (e.g. >1000 pts show a star; >5000 pts show a trophy; etc.) then you would just make a rule for that based on the value of the table cell.
Maybe I need more explanation about what you're trying to accomplish.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
but as previously stated we may need more info before we can really help you much.
I am trying to create a pop-up message that displays an Image that says "SCORE" and the users current score next to it. I tried to use the display text behavior and concatenate the image to the table cell value which holds the score...
image.png..tableCellValue(TB1,2,1)
But this did not work. I thought an attribute representing the image would solve this. Is it possible to display images using display Text behavior?
There are other elements that I want to incorporate into this pop up. Is it possible to use an actor to display several changing values and a continue button? or would I have to use a separate screen?
Hope i explained myself clearly and Thank You guys for all the help!
Knedy
Why not just use separate actors? One for the word "SCORE" (either DisplayText or a static image) and one for the the actual score value (DisplayText).
You can have something appear on the screen as a pop-up if you use the Pause Game behavior and put the actors on their own scene or you can move the actors from an off-screen location to an on-screen location or you can hide the actors using self.color.Alpha=0 until needed. In the latter cases, make sure the pop-up actors are in the highest layer so they show up on top.
While Pause Game makes the process very simple, it makes your app slow in terms of the pausing and unpausing of scenes.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I tried that. I followed tshirtbooths tutorial but i couldn't make it work for what I'm trying to do.
@tatiang
Thanks a lot! I used the self.color.alpha technique and it worked, with one exception. The score value in the display text behavior is not hidden for some reason. I made sure that the actor was on alpha=0. The background of the actor is hidden when the scene starts but the text shows. Am I doing something wrong?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
If game.popup is false display empty string, else display game.score value.
It actually worked.
Thanks again for your help!