sprite with different image & function

Get help using Construct 2

Post » Thu May 25, 2017 6:10 am

can 1 spirte have different image & function , if yes how to do it ?
i want 1 sprite have 4 different image & 4 different function

Thank You
B
9
S
2
Posts: 9
Reputation: 545

Post » Thu May 25, 2017 6:58 am

You can use animations or simply use different animation frames from a single animation.

You can base the function of the sprite based on the animation or animation frame that's being used.

psuedocode:

create object -> set animation frame to random(4)

object.animationframe = 1
---- do something

object.animationframe = 2
---- do something else

etc

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499

Post » Thu May 25, 2017 12:52 pm

Message: dzert14 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
hemm i want when preview like this http://prntscr.com/fby49i but 1 sprite with 4 image and each image have own function , still confusing
B
9
S
2
Posts: 9
Reputation: 545

Post » Fri May 26, 2017 7:17 am

Make a sprite, call it "button"

Add 4 animation frames and set the animation speed to 0 (so it doesn't "play" through the frames) - and set each frame to be one of your button graphics;

Frame 1 would be the book
Frame 2 would be the man running
Frame 3 would be the gear
Frame 4 would be the window/box thing

Then you can set the animation frame for the sprite to be whatever you want the button to look like... so if you set to frame 1, the button will be the book, or if you make it frame 3, it will be the gear.

Then you can choose how it will behave simply by comparing which animation frame is playing.

On Mouse.click
--- Button.AniFrame=1(book)
-----> Open book menu

On Mouse.click
--- Button.AniFrame=2(running man)
-----> Open running menu

etc etc

I would make an example for you but I'm at work right now. Hopefully I explained it better this time. :)

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499

Post » Fri May 26, 2017 11:11 pm

Uh sorry newly replied now, I already understand now, Thank You
B
9
S
2
Posts: 9
Reputation: 545


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 29 guests