veg in the bag game..

Get help using Construct 2

Post » Sun Dec 22, 2013 9:25 am

hi guys..just a small issue..i have a bag which collects veggies falling from top and increase the score..i randomize the sprite frames in the animation set to show different veggies falling in.
the problem is that during the fall..since the new veggie create code is executed, the set frame commands executes and changes the veggies which have already been created during its fall..i hope i am clear..

how can i stop this? i am using a function which checks if the veggies are from recipe one, then set frame to 0 and 1 and if veggies are from recipe 2 then set frame to 2,3. during the fall the veggie suddenly switches frames..if you are able to run the capx file, you will know exactly what i mean.


i have uploaded the capx file plus the screen shots incase you cannot open the capx file since i am using the tweenlite behavior.

www.dropbox.com/s/t4ngr14rfc9cj2f/bag.capx
www.dropbox.com/s/jp9arkep6pqyxr8/gameplay.png
www.dropbox.com/s/mxlmmauf2d8uarb/veg_sheet.png

thanks for your help in advance guys!
ameer.
B
7
S
2
Posts: 18
Reputation: 573

Post » Sun Dec 22, 2013 9:38 am

set the frame in an on created event. that way only the created instance will be picked and changed.

your system compare event doesn't pick any instances, therefor all instances are affected.
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 » Sun Dec 22, 2013 9:43 am

Thanks!
Is this what you mean.please check the jpeg..its works fine now..but still want to get your opinion if this is what you meant..

www.dropbox.com/s/elrxe2bn2ck62yb/changed_value.jpg

ameer.
B
7
S
2
Posts: 18
Reputation: 573

Post » Sun Dec 22, 2013 10:09 am

That is one way of doing it that works.
Because the check events are subevents of the creation, only the created instance is affected.

Picking is an important part of creating events in Construct2, you will always have to tell the program which instance to act upon. In this case it's clear it's the created one.
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 » Sun Dec 22, 2013 10:22 am

Got it! Thanks so much.
ameer.
B
7
S
2
Posts: 18
Reputation: 573


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, brunopalermo, Euduardo, Jackriduk and 31 guests