Pop up Image
Lindsay44
Member, PRO Posts: 16
So in my game I have clickable animals that make noise when touched, but I would also like when you click them a separate box to pop up at the top of the screen with the animal name in in, ex "DOG". How do I do something like that, I have been working at it for days, and have hit a road block it seems ... I have many animals per screen (four scenes total) and I want the name plate to disappear after a couple seconds.
Thanks
Thanks
Comments
create two attributes:
animalName = text
showAnimalLabel = boolean
put your label actor just off screen. in it have a rule that says
when showAnimalLable = True
interpolate self.position.y to XXX - where XXX is a position on screen you can view it
timer: after 3 seconds
change attribute game.showanimalLabel = FALSE
otherwise
interpolate self.postion.Y to XXX - offscreen position
have another rule in the label actor
displayText animalName
(you could get fancy and use images instead)
constrain attribute self.image to animalName
(for this to work, if you were trying to display dog, your image file would have to be called dog.png)
then in the animal actor itself
when touch is pressed
change animalName to (whatever you want here)
change showAnimalLabel = true
that should do what you want
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Create a table and create as many columns (or rows) as you have animal blocks.
Fill each one with the animal name. For example, if the first animal (from left to right) is a penguin, in your table (column 1) write "penguin."
You'll need to create a boolean attribute that will turn to true when any animal is pressed.
In your popup box actor:
When boolean attribute is true,
Display text: tableCellValue(game.AnimalTableName,X,Y) ---- X is the row of that animal name, Y is the column of the animal name.
Interpolate: self.Color.Alpha to 1 (duration is up to you).
OTHERWISE:
Interpolate: self.Color.Alpha to 0 (duration is up to you).
Also inside your box actor:
In a separate actor, preferably one that controls other things in the game, like scene changes, scores etc:
Rule: When attribute boolean attribute is true,
Timer: After x amount of seconds,
Change Attribute: game.boolean attribute to false
Hopefully that puts you on the right track...
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Please don't create multiple threads for the same issue.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang sorry, won't happen again