How do I solve instance issues ?

Get help using Construct 2

Post » Wed Oct 19, 2016 9:50 am

once again I need you precious help...it's all the morning from 7:30 that i have problems to understand how to solve my problem: as u can see if my mouse goes over the green shape..it makes rotate the red...but i want to rotate ONLY the one that is touching ...not both red sprites ...! I need this in reality if a bullet hits the green sprite...so it makes rotate the spinning object...but mouse was maybe clearer here... THANKS


link
https://lookaside.fbsbx.com/file/help.c ... Aa-w5IbDL5
B
37
S
16
G
2
Posts: 447
Reputation: 4,865

Post » Wed Oct 19, 2016 1:48 pm

http://blackhornettechnologies.com/Construct2Stuff/help_BHT.capx
One way is with a Container, to associate the two sprites together.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Wed Oct 19, 2016 1:59 pm

You use a global variable in your project to set the sprites rotating. That's the problem because if that one variable is true, all sprites start spinning. You need to test every single object and the way I would do that is use an instance variable for each object that is set to true if the mouse is overlapping it.
Then if the instance variable of the object is true, the sprite will start spinning.
i hope I could help! :)
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Wed Oct 19, 2016 2:09 pm

Actually, a bullet is a different problem, so Containers won't actually help. I realized this after. An actual bullet example would be better to work with.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Wed Oct 19, 2016 3:13 pm

You still can use touch object. Just register active object UID while touching:
https://dl.dropboxusercontent.com/u/659 ... p_rev.capx
ImageImage
B
109
S
49
G
23
Posts: 783
Reputation: 22,636

Post » Wed Oct 19, 2016 6:22 pm

ok guys...first of all thanks... could you help in this :
https://lookaside.fbsbx.com/file/angle% ... 2RlBspL0qr

this is way simpler...if bullet hitts the sprite...it should simply rotate smoothly 30 degrees.... if its not outfading as roation its fine...what is the simplest way ? thanks
B
37
S
16
G
2
Posts: 447
Reputation: 4,865

Post » Wed Oct 19, 2016 8:24 pm

You can't rotate smoothly with "one time" condition. Because when the condition is true also exit almost the same time
You need to maintain the condition true by using boolean.

Here I fix it for you:
https://dl.dropboxusercontent.com/u/659 ... e_fix.capx
ImageImage
B
109
S
49
G
23
Posts: 783
Reputation: 22,636

Post » Thu Oct 20, 2016 4:19 am

first of all ..thanks...there is just another thing....I need that on each shoot it spins again 30 degrees.... on the fixed...after 30 degrees it stops.... how can i do that ? with same cool smooth effcet that u did


THANKS SOOO MUCH !
B
37
S
16
G
2
Posts: 447
Reputation: 4,865

Post » Thu Oct 20, 2016 4:21 am

.. like a spinning door...each shoot makes it turn a bit...smoothly
B
37
S
16
G
2
Posts: 447
Reputation: 4,865

Post » Thu Oct 20, 2016 5:17 pm

You mean one shot will turn 30 degree and second shot will turn the door into next 30 degree?
ImageImage
B
109
S
49
G
23
Posts: 783
Reputation: 22,636

Next

Return to How do I....?

Who is online

Users browsing this forum: Jackriduk, Tombas and 22 guests