Calling an image or text with one click

Discussion of tools and resources for game developers

Post » Tue Jan 27, 2015 5:41 am

Hello, I started some time studying the construct 2 and would like to know how do I click a button and call a random image or text in different layers. Thank you for your attention.
B
9
S
1
Posts: 1
Reputation: 427

Post » Tue Jan 27, 2015 4:25 pm

First you have to decide how your going to call the image when you click the button.

You can use "Spawn another Object" if your going to create from a specific object or sprite.
You can use "Create Object" event under System.

Then create a Global Variable called "Images" for example.
Then Make a series of statements like so:

System (compare variable) like so:

System > Images = "Sprite 1" > System >Create Object >Sprite1, Layer 0, X,Y

Create a statement of code for every sprite or text you want to be able to create.

Then when the button is clicked use:

Button > On Clicked > System (set value) > Images = choose(sprite 1, sprite 2, sprite 3, etc...)
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,273


Return to Tools and Resources

Who is online

Users browsing this forum: No registered users and 2 guests