Pickup/PutDown Object Conflict

Get help using Construct 2

Post » Sun Mar 03, 2013 1:53 am

This is my first post. Woo!

I have something occurring that doesn't make sense. I've banged my head long enough and need some more eyes on it... Hopefully someone sees something obvious!

I have a character and an object. I want to hit Space to pick up or put down the object. Super rudimentary right now. I have a boolean on my Player called "equipped". I check on every tick to see if it is true and set the position of the object to teh Player if so. Pickups worked just fine! Then when I added the put down, it just stopped working. There seems to be a conflict, but it's not obvious to me. Here's the event sheet:



Event 11 works if 12 is disabled, but 12 overrides 11 if they are both enabled. This doesn't make sense to me since the condition for 12 is not true (i'm rendering the boolean to a text value to make sure)

This is also running on Every Tick, but seems fine:



Thanks for any help!GabeOfThrones2013-03-03 01:55:58
B
8
S
1
G
1
Posts: 37
Reputation: 1,326

Post » Sun Mar 03, 2013 2:01 am

Right after 11 happens, Construct detects that 12 is true because you just made equipped = true.

C2 works in that order, you solution might be in adding an Else before 12.
B
36
S
10
G
6
Posts: 948
Reputation: 11,101

Post » Sun Mar 03, 2013 2:02 am

Also to add on, a smarter solution to making the object follow the player would be to use the pin behavior on the item object, on pressing space when objects are colliding move it to the player and pin it once. No need to do it every tick :) hope this is useful to you!
B
36
S
10
G
6
Posts: 948
Reputation: 11,101

Post » Sun Mar 03, 2013 2:23 am

Thanks for the quick reply, Rory! I was suspecting it was something about C2 that I wasn't realizing. The else did the trick. I mistakenly figured that once it found a true set of conditions that it would break out of the event after it ran the action. Wrong!

Also, great advice RE: the pin. I wasn't aware of that functionality yet, but I'll give it a try!
B
8
S
1
G
1
Posts: 37
Reputation: 1,326

Post » Sun Mar 03, 2013 7:32 am

I tried the pinning. Pretty sweet, but it's curious that it doesn't let you choose the preferred registration point. It just kinda gloms on wherever it happens to be. May have to rethink implementation...
B
8
S
1
G
1
Posts: 37
Reputation: 1,326

Post » Sun Mar 03, 2013 5:22 pm

You can do something like

Every Tick > If Equipped > Sword > Set Position to another object > Hero (Select the Hand Image Point at y=510 That you made in the sprite editor)cincipon2013-03-03 17:24:00
B
6
S
1
G
1
Posts: 70
Reputation: 702

Post » Sun Mar 03, 2013 5:26 pm

Yeah, the obvious advantages of C2 separating pinning and moving the object to the point would be that you can pin two objects which don't need to be at preset points, endless possibilities in physics games.

Glad the advice helped!
B
36
S
10
G
6
Posts: 948
Reputation: 11,101

Post » Tue Mar 05, 2013 5:37 pm

What is pinning doing under the hood? I assume it is also some sort of every tick, set position sort of thing. Is it really less taxing?
B
8
S
1
G
1
Posts: 37
Reputation: 1,326

Post » Tue Jul 23, 2013 10:18 am

Yes I presumed that is what is does also GabeOfThrones

Not entirely sure but it seems to be the same thing functionally.
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
29
S
11
G
8
Posts: 312
Reputation: 7,333


Return to How do I....?

Who is online

Users browsing this forum: Aphrodite, Yahoo [Bot] and 19 guests