tapestry's Recent Forum Activity

  • Does building for Android with Construct 3 export the APK directly?

    Or does it provide the gradle and build files for you to build the project?

    If it's the former, then it sounds like inspecting the manifest will help. You can learn about extracting the manifest from an APK here:

    stackoverflow.com/a/4191807

    If it's the latter, you should be able to view the manifest from the Android project.

  • Just to be extra clear about this. The reason why "set animation 'stand'" didn't work is because that's just affecting the animation of the character, which is purely visual. It has no bearing on the platform/movement behaviour of the object.

  • I haven't used the new beta, but are you sure this function is meant to get an argument?

    From the look of it, these functions are all mapped from regular JavaScript:

    developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getMonth

    Unfortunately Dates in Javascript are pretty complex and bizarre. There are a lot of different ways of achieving the same thing and the API has a fair bit of legacy.

    Maybe you can experiment with the regular JavaScript API in the Chrome console (or browser equivalent) and then try and apply those learnings to C3's API.

    And I'd recommend double checking that it really takes an argument, as I mentioned at the start.

  • If it's online multiplayer (which moomoo.io seems to be) then each game client (i.e. the game running on each individual person's machine) will just need its own camera that tracks the individual player.

    You could think of it like this:

    - The current player has a sprite object that represents them.

    - All other players from the perspective of the current player, should have their own instance of a separate sprite object type called otherPlayer.

    - You'll need multiplayer logic to handle users joining and disconnecting a game server. You'll want to propagate the join and disconnect events to all other players.

    - Then in your game, you'll listen for new or disconnecting players and create or destroy 'otherPlayer' instances as necessary.

    - One trick, have a unique player ID for each player, store that as a variable on each instance of otherPlayer.

    Ideally they'd probably all be the same object type but for initial development it might be easier to make them separate, i.e. "currentPlayer" and "otherPlayer".

    I hope that points you in the right direction. If none of that makes sense I'd recommend looking up tutorials on the multiplayer object in Construct's docs.

  • Back in the C2 days, I built a hacky little plugin that allowed me to load the contents of another layout into the existing running layout. I could choose to load everything from the layout and it would map the layers from the loading layout to the running layout's layer names. Or I could single out a particular layer to load from and load into. It was very useful for a variety of games, such as...

    Stitching together a random set of scenarios:

    I used it to stitch together random gameplay scenarios. For example, it's an endless randomly generated game except the content is a series of scenarios that are picked from and each scenario was setup as a separate layout. Therefore each of these layouts were never "run" themselves, they were simply loaded. The height of the scenario was used to also inform the main running layout of where to stitch the next layout.

    Loading scenes in an adventure game

    This one may sound more abstract but it was just another application of the plugin. I would load "cinematic" scenes that were prepared as separate layouts and have them appear in the main running layout.

    What I'm wondering is, do I need to build another plugin in C3? Or is this now possible through some new event API in C3 or via Scripting that I don't know about?

    At the most basic level, all I really need is a way to read the contents of another layout, its layers and its instances. If I could read properties of the other layout and the layers as well as the instances, that'd be even more powerful.

    Alternatively, is there a way in the Scripting API, to access the JSON that represents the initial game data?

  • Ok. It's good to hear that there's a plan to expand the API.

    I can understand that not everything is directly portable. Hopefully some things (like Touch.TouchCount) are more straightforward than others though.

    And thanks for answering some of this over the weekend Ashley.

  • Ahh interesting.

    The bindings for these core objects are very limited then? For example when I look at the Touch object, it appears to have only one function? (requestPermission). Although I can now see that you have a set of runtime events such as mouse down which would presumably provide access to "on touch is down" as well.

    Are there plans to expose the ACEs of objects to the scripting interface? It would seem like a very logical progression of the scripting experience, right?

  • Oh interesting...

    I did try that but none of the functions of the Touch object seem to be accessible. Is that right?

    I looked at the alien game example recreated in scripting and I can see that this works:

    runtime.objects.Keyboard.isKeyDown("ArrowRight")
    

    But on the other hand, none of these work:

    runtime.objects.Touch.X
    runtime.objects.Touch.TouchCount
    runtime.objects.Touch.XAt(0)
    

    Do only some objects have access exposed to scripts? I think ideally you'd want to make it so that any expression in the event editor be made available to scripting, right?

  • Aaand... I figured it out for questions 1 and 3. But I still can't figure out a solution for #2.

    For anyone else that encounters this and wants to know:

    #1

    The trick is that you need access to the runtime object. Be sure to always pass the runtime to the scripting world from the event editor when you call the script function. For example you script function should be defined as:

    function foobar(runtime, x, y) {
     ...
    }
    

    You can have whatever other variables you want but I'm guessing a best practice is to always make 'runtime' the first variable.

    Then inside your scripting function you can call an event editor function via runtime thus so:

     runtime.callFunction("eventFunction", [1, 2, 3]);
    
    

    The array will be used as the ordered arguments of the function call.

    #3

    This was achieved via the runtime object as well:

     runtime.globalVars.foo
    
  • Hey all,

    I'm starting to learn about the scripting system and I have a couple of questions. The most important being the title of this thread:

    #1 - I know I can call a function defined in the scripting world from the event editor. But is it possible to do the reverse? i.e. call a function defined in the Event Editor from the scripting world?

    #2 - Are global game objects available in the scripting world? For example, I don't seem to be able to call Touch.X - which normally works in expressions in the event editor.

    #3 - Lastly. I figured out how to pass a local variable from the event editor to the scripting world. i.e. "localVars.foo" – However is there a way to pass global variables? This is similar to #2 honestly.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm experimenting with a multiplayer game and I need an authoritative server that also has a copy of the noise generated from some of the Advanced Random plugin.

    But the code for the plugin is in WASM it seems? And therefore I can't see the source code for the JS?

    Anyone know if the algorithms are documented somewhere?

tapestry's avatar

tapestry

Member since 23 Feb, 2019

Twitter
tapestry has 1 followers

Trophy Case

  • 5-Year Club
  • Email Verified

Progress

6/44
How to earn trophies