locohost's Forum Posts

  • I have a top-down game. 384/128 is a position directly above (North) of the Worker sprite. But when I click the Worker it moves to the right (East). The angle calcs to -90, why not 0? Why is the angle calculation not working?...

    [attachment=0:55hdm4g4][/attachment:55hdm4g4]

  • > For me:

    > ... 1) Instance methods or pass object instance ref into functions

    > .

    >

    I do that using Params, and I pass object UID, then I pick object by UID within function

    I'm already doing this. Not the same thing. I'm looking for something better and I'm pretty sure it's never gonna happen

  • The events are intentionally a subset of a traditional programming language. That is why they advertise "no coding required". For those that want to "do coding" that is what the JavaScript SDK is for.

    This is true. I'll look into coding a behavior sometime very soon.

  • jayderyu Wow. I'm not sure what to think about that

  • The layer was locked. Somehow I clicked the lock icon. Unbelievable. I must be tired

  • The collision/bounding box is the full size of the 64x64 square sprite.

  • Why can I sometimes click a sprite instance on the layout and other times nothing I do will allow me to select any sprite? What is happening? I can't believe I have to ask this

    Every other layer except for the one containing these sprites is hidden. I select the layer so it's the active layer, I still cannot select/highlight any instance on the layout. WTH?

  • For me:

    ... 1) Instance methods or pass object instance ref into functions

    ... 2) Create an object instance by a string name

    If using a string name to ref the object is out of the question due to obfuscation issues (as Ashley mentions in another post), then show me the object-type "sid" in the editor status bar when I click an object. Then give me an action CreateObjectBySID(someSIDNumHere). Now I can put the SIDs in my Xml files and dynamically create any/all objects I need by their SID.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Tylermon

    There isn't really an issue, not exactly, just some coding and C2 objects functionality Q&A

    I was hoping for a way to have instance methods in C2. There isn't such a thing right now. I was hoping for an existing behavior that might provide this functionality. It doesn't exist. PixelRebirth made the point that calling onFunction events, passing in the instance.UID as first param pretty much duplicates the behavior I described in OP.

    The issue, if we in fact have one, is does the Object.PickByUID action iterate every instance to locate/return the one instance I want by it's UID. Or does it somehow directly select/Pick an instance in memory with the UID. If the latter, than onFunction(inst.UID, param1, parm2..) will be fine for now or maybe forever. If the former, I need to start thinking about building a custom behavior.

    Which of the following illustrates how Object.PickByUID works...

    // 1
    Monster.PickByUID(paramUID) {
        foreach(allMonsterInsts as m) {
            if (m.UID = paramUID) return m
        }   
    }
    
    // 2
    Monster.PickByUID(paramUID) {
        return allMosterInsts[paramUID]
    }
    [/code:24ajdh7c]
    
    If PickByUID action works like 2, then I'm fine with just using onFunction and passing in the UID. If it's 1, then we need something better like instance methods as I described in the OP. Or perhaps a way to pass an actual object instance reference into onFunction like @PixelRebirth said.
  • Can we ask Ashley some how?

    If Object.PickByUID gets a reference to the instance without iterating them all, then PixelRebirth is right, just keep using onFunctions with the PickByUID action on param0. Otherwise, someone (me I guess) needs to look into building the behavior described in OP. Which will be time consuming.

  • How can we find out how the Object.PickByUID action specifically works? If it has to iterate every object instance, it's pretty bad. And I agree, being able to pass object refs into functions would work perfectly. If it iterates all instances, I'll be forced into building some kind of behavior like I described in OP.

  • PixelRebirth

    [quote:2ouv2zg6]seems like you're asking for C2 events to be more similar to coding languages you appear to be familiar with.

    Uhhh yes

    Aren't many of us Javascript programmers? If we're building any C2 plugins we sure need to be right?

    I will agree with you right now if the first line in my C2 onFunction, which is always SomeObject.PickFromUID, is super, super, instantly fast and does not have to search all SomeObject instances to find that one UID to Pick the instance. If the latter is true, then my suggested behavior will save eeeenormous amounts of time by passing a calling instance reference into the function. Follow?

  • I'm really wanting to add methods to my objects. I'm certain you are too For now I'm faking it by creating appropriately named functions that take an instance UID as the first param. Is there a better way to fake this?

    What we really need is a "object function" or "object method" behavior that we can add to any object that will call a specific function and automatically pass in a reference to the calling instance in a variable/param called "this". Now we can add this behavior to our Sprites (or anything really) and give it a reference to an existing function which act like instance methods. Then in code we call Sprite.ChangeAppearance(param1, param2, param...) and the function "ChangeAppearance" gets called and is passed a reference to the calling instance object as the first param, as well as each specified custom param.

    This seems like such an obvious behavior. Has anyone coded this yet? I'll search a bit and hope...

  • Here's a thought: Could I manage this with "Wait for signal"s? Maybe?

    No doesn't appear this will work

  • Here's a thought: Could I manage this with "Wait for signal"s? Maybe?