Pickup/PutDown Object Conflict

0 favourites
  • 9 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • 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:

    <img src="http://www.gabemiller.com/images/c2bug.jpg" border="0" />

    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:

    <img src="http://www.gabemiller.com/images/c2bug2.jpg" border="0" />

    Thanks for any help!

  • 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.

  • 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!

  • 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!

  • 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...

  • 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)

  • 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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?

  • Yes I presumed that is what is does also GabeOfThrones

    Not entirely sure but it seems to be the same thing functionally.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)