DevRaccoon's Forum Posts

  • 4 posts
  • Okay, I think I get it now! And most importantly it works

    Thanks for the help everyone.

  • TELLES0808

    I went back and tried that method on my test file

    As I understand it, you create a kind of 'surrogate UID' which is more reliable than the UID and which can be picked with the Compare Instance Variable function

    ...but when I did this, I couldn't get the function to recognize any of the objects! I honestly have no idea why, and I think it may have something to do with how Functions are called, but I don't know.

    Prox

    I was under the impression that 'Hop' would be activated once for each instance of obj_creature for which Active was true - since all events are supposed to have an implied 'for each' loop through them

    If this is not the case, how would I make this happen (since a For Each loop cannot be run in the same event as another Trigger) ?

    EDIT: I made a silly mistake in implementing the ID trick, but that still left me with only the first object hopping

    EDIT AGAIN: Figured out how to make the 'For Each' loop work properly, thanks for that. But I'm still very curious as to how the function works to need that, if anyone has a clear understanding of the 'under the hood' of picking in this instance

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm having some difficulties working out precisely how Function calling and Parameters work for my project

    Basically, in my main project, I have a family of sprites with a wide variety of behaviors that I would like to make as separate Functions, but I'm having trouble passing the right 'picked' instances to the function

    Right now I'm passing the UID of the instance to the function, but the problem I'm running into is that, if the function is called multiple times per tick, only the first UID is acted upon.

    I've got a simple project demonstrating the issue:

    dl.dropboxusercontent.com/u/59997937/Project%20Help/Picking_with_Functions.capx

    (note that my own project is much more complex than this, so I'm not looking for work-arounds to make this specific demo work)

    In it, there are a number of instances of the same sprite. Those instances have a boolean 'Active'. Any instance with 'Active' true should use the function 'Hop'. But if more than one instance is active, only the first instance hops.

    I hope this makes sense, I haven't found anything on the forums beyond passing the UID to the function. Thanks in advance!

  • This is a pretty old topic, but it's on the FAQ page and States are important, so...

    I make a Multi-State object by giving the object an Instance Variable which I call "State", which I set to a String. Make the default something like 'Walk' or 'Move'

    For your purposes, add both Platform and 8-Direction, but disable the 8-Direction to start.

    On the event sheet where you handle controlling your player, begin with the event "Compare Instance Variable" and see if it reads "Walk" Put all walking, running, standing on ground behaviors there. For your purposes, there you would use 'Set Enabled' to Enable Platform and Disable 8-Direction

    Next, when your player makes contact with the water, set 'State' to "Swim" and set it back to "Walk" when the player is not in contact with water (I think the 'Overlap' function would work there)

    Then, same thing, do a 'Compare Instance Variable' to see if State is "Swim", disable Platform and enable 8-Direction, then put in all your Swimming Behavior (such as changing animations to swimming, any swim-specific controls, even adding an Air Meter to the HUD if you'd like)

    It may seem a bit complicated, but that system (based off a Finite State Machine, if you want to look that up) is extremely powerful and makes for fairly clean code once you get used to it. You can use that same 'State' variable for climbing ladders, flinching on taking damage, and anything else that temporarily changes the behavior of your character.

    Hope that helps somebody!

  • 4 posts