How do I Fix this? Rotary Kinda game!

Get help using Construct 2

Post » Fri Jun 09, 2017 5:27 am

Image

Please help me with this, I am not able to get it, what's wrong in this, or how should it recognize 2nd planet as there will more planets to add randomly.

Here is code I am working

Image
Every Game is a Good Game it's just few people like and few does not! Keep coding people some day you will be a "NOTCH".
B
21
S
6
G
3
Posts: 85
Reputation: 4,607

Post » Fri Jun 09, 2017 5:36 pm

Hi @iGamersBox

I'm not sure the full settings that you use on your game so I did it on my way, at least it answered the main question why the planet don't get recognice, I hope it helps.




Capx: https://www.dropbox.com/s/am8oj6q2mj1sdbr/GravityPlanets.capx?dl=0


The problem you had in your example is that you had an

>>Every thick: set the player angle to the planet, but you don't specify wich one so C2 will always pick the first planet, So when you change the planets as you don't specify on wich planet you are in C2 will always pick the first planet every time.

So what I done is, create an instance variable "PlanetGrab" to the Indicator objects and I linked Each one of them to their Planets UID, I done this manually but you can do it in auto mode if you like,

Then I create an instance Bolean: "Is Active" to the planets so the player can trigger on wich planet is currently in
B
38
S
22
G
63
Posts: 233
Reputation: 35,554

Post » Fri Jun 09, 2017 6:19 pm

The solution is perfectly what I was aiming for, @tarek2 it couldn't be better. Selection through UID is kinda next level for me but, I'll be exploring more options for game mechanics with UID and how can I use it better in games.

Thanks once again for your help.
Every Game is a Good Game it's just few people like and few does not! Keep coding people some day you will be a "NOTCH".
B
21
S
6
G
3
Posts: 85
Reputation: 4,607

Post » Fri Jun 09, 2017 9:56 pm

iGamersBox wrote:The solution is perfectly what I was aiming for, @tarek2 it couldn't be better. Selection through UID is kinda next level for me but, I'll be exploring more options for game mechanics with UID and how can I use it better in games.

Thanks once again for your help.



@iGamersBox cool I'm glad it helped

You probably will have many planets and will be a pain to link manually all the Indicators to their planet, so I thought I will update the capx to show you one of the ways to do it, just in case you didn't know. it is just two more lines of code.

Capx to assign in auto mode: https://www.dropbox.com/s/qykbfd9utqqlwgk/GravityPlanets2.capx?dl=0


Yes Selection through UID it helps simplify the code and it's more convenient, you should also have a look to combine it with Family's it helps in performance if you have many objects, and if you feel adventurous even with Functions too.


Here is a simple Example to get you started, it uses Families and Functions: https://www.dropbox.com/s/jeq49flgj1wrq1w/Create%20Healh%20bars%20to%20multyple%20instances2.capx?dl=0


Here is a good tutorial to know more about UID:
1-: https://www.scirra.com/tutorials/361/understanding-uid-iid-health-cards-and-rocket-smoke-trail

2-:https://www.scirra.com/tutorials/556/understanding-picking-with-respect-to-families
B
38
S
22
G
63
Posts: 233
Reputation: 35,554


Return to How do I....?

Who is online

Users browsing this forum: OBLIVION, zenox98 and 14 guests