RadicalMediaZA's Forum Posts

  • 6 posts
  • Hi guys,

    I'm attempting to use your Lockbox to encrypt Web socket data before sending. The Construct part is fine, it's working well, but I'm having trouble decrypting on the other side (I've tried a NodeJS server and .NET) Are there any examples of the backend required to decrypt the resulting AES/CCM protocol? This seems like a particularly difficult protocol to decrypt as IV length can vary according to data length, or am I mistaken?

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That worked brilliantly, thanks again. I had to adjust some code to allow cross-iframe communication with my base js. For anyone following up on this thread, use:

    <Inside iFrame>

    function calledFromConstruct(_score) { // This is called from Construct using Execute Javascript "calledFromConstruct(score)"

    localStorage.setItem("myScore", _score);

    window.top.postMessage("myMessage", "*");

    }

    <Inside wrapper html page>

    $(window).on("message", function(e) {

    if (e.originalEvent.data=="myMessage") { // Filter out messages from other iframes such as those generated by FB iframe

    var theScore = localStorage.getItem("myScore");

    // Do something with score

    }

    });

    I saved the game score inside localstorage so both the iframe and the wrapper page have access to it.

  • Great idea, thanks Ashley!

  • > So I'm working on exactly the same type of game and this is what I implemented (I'm assuming you have a pipe sprite called "Pipe" and a bird sprite called "Bird"):

    >

    > 1. Keep a variable inside each of your pipe sprites called "Scored" and set it to false upon Create Object. This we will toggle once the pipe has a lower x-position than the bird (bird has "flown past", ie pipe has scrolled left past the bird). The reason for this is if we don't set Scored to true once the bird has flown past, it will continue to score that pipe.

    > 2. Add first-level action "Pipe.X <= Bird.X" AND a condition "Pipe: NOT Is Scored" (Pipe is not Scored, ie. Scored is false) which will test ALL pipes for which Score is false's x-location against the bird's x-location and run a command if true. The command simply adds 1 to your Score variable ("Add 1 to Score") and sets the variable Scored to true FOR THAT PIPE (Pipe: Set Scored to true action). Again, this is to prevent the pipe from being scored on every click.

    >

    > There may be a more elegant way (you could investigate dwesley's invisible sprite method) which may be more processor-friendly, but this worked for me.

    >

    > Hope this helps!

    >

    I've tried this method and everything looked like it was correct but it didn't seem to work for me. I'm a complete novice so I'm still learning a lot of the ropes of construct 2. I will give this method a try again before trying the invisible sprite one. Maybe this time i'll get whatever I was missing before. Thanks for your help. Appreciate it.

    Sorry, of course I meant Lancifer's invisible sprite method

    As a newbie, try using the Chome Console plugin to log some debug data when your bird flies past a pipe (See for the download and read up on how to install plugins.) This data will show up in Chrome's Console tab (right-click on the html page and select Inspect from the drop-down list to show the console).

  • So I'm working on exactly the same type of game and this is what I implemented (I'm assuming you have a pipe sprite called "Pipe" and a bird sprite called "Bird"):

    1. Keep a variable inside each of your pipe sprites called "Scored" and set it to false upon Create Object. This we will toggle once the pipe has a lower x-position than the bird (bird has "flown past", ie pipe has scrolled left past the bird). The reason for this is if we don't set Scored to true once the bird has flown past, it will continue to score that pipe.

    2. Add first-level action "Pipe.X <= Bird.X" AND a condition "Pipe: NOT Is Scored" (Pipe is not Scored, ie. Scored is false) which will test ALL pipes for which Score is false's x-location against the bird's x-location and run a command if true. The command simply adds 1 to your Score variable ("Add 1 to Score") and sets the variable Scored to true FOR THAT PIPE (Pipe: Set Scored to true action). Again, this is to prevent the pipe from being scored on every tick.

    There may be a more elegant way (you could investigate dwesley's invisible sprite method) which may be more processor-friendly, but this worked for me.

    Hope this helps!

  • Hi all,

    I've got single-page js app which contains a construct canvas placed inside a <div>. On MOBILE, once the construct canvas has been initialised, it attaches some events to the document root (such as touchstart and touchend). These bindings cause the normal scrolling ability of the mobile browser to break as the attached bindings call "preventDefault()". Right now I can get around it by editing the c2runtime.js code to check if a global variable "gamePlaying" is true. If not (the game is not visible), it stops the call to preventDefault(). This works, but is super-hacky. Is there an easier way to unbind the "ontouchstart" and "ontouchend" events when the game is not visible? I've tried to suspend the runtime, but this doesn't work as desired.

    Thanks in advance for any light you may shed on this challenge.

  • 6 posts