How do I make a sprite's instances move different ways?

Just started using Construct 2? Post your questions here

Post » Wed Oct 01, 2014 7:58 pm

Hello all,

I have this dumb problem that I can't solve. It must be easy but I can't see it :?
. I have a box (Sprite), of which I made 3 instances.
. I want to have the box move up when I click on it.
. The trick is I want the boxes to move at different heights depending on which one I click.

Is it possible to do that (with UID or something else), or do I have to clone my sprite and create different events (for three different objects as opposed to three instances)?

I'm very new at all this, tried to look at examples and searched the forums, but didn't find much or nothing that was clear for me...

Thanks in advance for any sort of help!

Piotr
B
17
S
1
Posts: 10
Reputation: 695

Post » Thu Oct 02, 2014 11:23 am

Many many ways to do this, but a simple first solution would be to give the sprites an instance variable (let's call it movepixels) and set it to the amount of pixels you'd want to move it..

then on clicked - move sprite.movepixels pixels

now it should be different for each box (if you set the variable to different numbers, that is)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Oct 02, 2014 2:07 pm

Man I feel so dumb.
That totally works. Thanks!
B
17
S
1
Posts: 10
Reputation: 695


Return to Beginner's Questions

Who is online

Users browsing this forum: vslk and 1 guest