aceofpack's Recent Forum Activity

  • rexrainbow

    Many thanks for your speedy help!

    I found the function. It accepts a parameter 'dims' (dimension of array to loop through) and within those loops calls another function using:

    this.doForEachTrigger(current_event);

    Which is:

         instanceProto.doForEachTrigger = function (current_event)

         {

              this.runtime.pushCopySol(current_event.solModifiers);

              current_event.retrigger();

              this.runtime.popSol(current_event.solModifiers);

         };

    What do these 3 lines of code do? I see a push and pop but not sure where the code for these functions are.

    Thanks for any help as always!

  • rexrainbow

    Many thanks but I couldn't see it...then discovered it's an Event not an action. Are we able to write events?

    Failing that, I could do a LoadArray type expression? Although a bit confused about the arrays in C2, do they take objects?

  • Hi all,

    I'm amending the socket.io plugin again and looking for some advice on actions:

    acts.ScriptName = function (params)

    {

    // do something

    };

    So I have an array called dataStack[].

    I'm pushing objects into it something like this:

    event = new instance.Event;

    event.name = blah; //String

    event.data = blah; //JSON

    event.time = Date.time(); //Time in ms

    dataStack.push(event);

    What I want to do is expose the looping through the array to C2.

    Something like a For Each Element action...

    How does this work and tie in with the loopIndex exposed to loops within C2?

    Many thanks for some pointers...

  • Thanks but I couldn't download the capx - free hosting 404 page.

  • Not sure what you mean...you haven't described what sort of mouse movement? Do you want something to point at the mouse or follow it? etc..

  • Can you provide some more detail on that statement.

    It reads ThrustTimer = Ship_Thrust.ThrustTimer % 5 = 0..

    There's 2 conditions in there which seems a little odd.

    Since you are setting the ThrustTimer back to 0 anyway, can't you just check for when it's value is equal to 5?

  • Hello all,

    I'm trying to get my head round doing the following set of actions using Construct 2. Could anyone lend me a hand :)

    I have a global var moveID.

    I increment this every time a move command is issued (like press right etc).

    I also add this value to a one dimensional array using [moveID] as the index and then the move value.

    What I want to be able to do, is take any moveID (let's say 100) and the array has values for example to 150. Loop from 100 to the end, extracting the values and adding them to another variable.

    Then delete all the indexed values we just looped through.

    I'm ok doing this in javascript but just need to understand what this will look like in c2.

    Many thanks.

  • Hi all,

    I've applied some mods to the already modified Zack0Wack0's original. Taken from JohnnySheffields version here.

    Here's my version:

    Socket io plugin

    New Expressions:

    Socket.DataAtVAr("variable name") <- this will allow you to select incoming values by using the variable name.

    e.g. if the sever sent {id:5, x:2, y:5} for an event "move player", you can do On event "move player" > Opponent.X = int(Socket.DataAtVar("x"))

    Socket.LoadDataJSONStringify <- this can be injected into a hash table or anything that takes a JSON string.

    New Action:

    EmitAsJSONString <- this will allow you to send data as JSON. It will convert the JSON string to JSON prior to sending. Note, because C2 does not allow using escape characters like \ or the use of single quotes. You need to escape double quotes using "".

    e.g: "{""y"":""" & int(MyPlayer.Y) & """}"

    converts to {y:value}

    I'm finding the DataAtVar and the EmitAsJSONString really workable and much cleaner than the comma values and LastDataElement.

    I'm working on a decent example for you all and a template server file for multiplayer. I'll release that soon for those interested.

    :)

  • I agree, HTML 5 is the future and javascript along with it.

    Scirra, from a business point of view have done the right thing to focus it now so they are in a prime spot in years to come - of which they are already for this corner of the market.

    A platform itself can still be abused, just like any coding language. There's still optimisation tricks to be had. As time goes by maybe we can have a knowledge base of optimisation tricks for common themes - or even a powerful reSharper (http://www.jetbrains.com/resharper/features/code_refactoring.html) type optimisation of javascript for gaming purposes.

    I'm still to test the speed on mobile and Android for certain things but I know there's so much you can do in the way you plan events and the mechanics of your game that will greatly improve performance.

    Believe in the browser, it is the only thing that interprets a common language across all devices. That's power.

  • Great :)

    That works:

    "{""y"":""" & int(MyPlayer.Y) & """}"

    A bit of an eyesore but it works!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "{\"y\":\"" & int(MyPlayer.Y) & "\"}" <- gives me syntax error unknown character (pointing to the \).

  • No, it doesn't like the \ either.

aceofpack's avatar

aceofpack

Member since 29 Jan, 2013

None one is following aceofpack yet!

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies