farflamex's Recent Forum Activity

  • Any chance you could help me out with turning this code into a 2d array in PHP? I understand the basic PHP syntax for 2d arrays, i.e array[0] [0] instead of just array [0]. Just struggling to work out how this is chopping it up into the array in the first place. For example, right now I'm sending a 10 x 3 array asJSON.

    This was your code from above to turn it into a 1d array. How do I adjust it?

    foreach ($c2ArrayData as $z) {

    foreach ($z as $y) {

    foreach ($y as $x) {

    $output[count($output)] = $x;

    }

    }

    }

  • Have you looked at this tutorial? Should get you started.

    https://www.scirra.com/tutorials/346/on ... -php-mysql

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How are the questions stored? If as some kind of object, just give them a variable which can be flagged once the question is asked, and reset it when you restart the layout.

  • You basically just need to check if ANY invader has reached a certain coordinate (left or right). At that point, ALL invaders make the downwards movement and change direction.

    Check the entire batch of aliens (with them all picked) to see if any has reached that point. If any were picked, you can set a variable and then in the next event, reverse the aliens if that variable is set. Alternatively, you can use a family to avoid the use of the variable, but it's a bit more complicated.

  • In the 'data' part right? As array.AsJSON as data? It's going through fine, now I just need to work out how to alter your PHP code from the other day to break it into a 2-dimensional array instead of a 1D one... find the PHP syntax tricky still xD

  • I have a few hundred variables that I want to post to my PHP file, to update into a database. My plan is to add these to an array, then post them array.AsJSON. Are there any limits on the amount of data you can send (either strict limits or suggested limits?). Is a few kilobytes of data too much?

  • So even in a sub-event they won't be accessible? I need to wait till the entire event finishes? This keeps tripping me up with C2.

  • But surely if the function creates the sprites, then immediately after returning from the function, sprite.count should show 10 (I made 10). Or is your point that the objects don't actually 'exist' at that point? If so, when do they begin to exist?

    I should say that I'm happy with having these as permanent objects anyway really, I can just keep them offscreen when they're not needed. But it'd still be interesting to know what happened.

  • Unfortunately not because it's huge and won't work without the access to my database. I've had no choice but to make the objects permanent from the start of the game instead of creating them just for a certain screen (and then deleting them later). It's working now, but I'm not sure what was causing that problem before.

  • I've been having the usual problem of not being able to use objects which have just been created which are on the same 'level' as the next groups of code. As such, I've had to move the function to create my objects to a higher level, so that the next group of code is in the level lower. But now the strangest thing is happening.....

    I create my objects in a function (which is at an even higher level and I can confirm that the objects are created) but in the very next line of code, when I do an object.count, it's back to zero.

    I've always had this problem with C2 and the solution is usually to check that the objects are created on a higher level, but it seems to have changed.

    So it's like this.

    -------> Call Function to create objects

    Object count is zero.

    --> Function to create objects (top level).

    Object count is 10 when leaving function.

  • All working fine now, thanks guys. Whole weekend's work, but got it done, can sort've say I can now select/update/insert from C2 into mysql database on my server... now I can sleep

  • Ahhh cool yes. I've been learning non-stop for about 5 days and although I read about == and === a couple of days ago, it's already been filtered out by the extra stuff. In fairness, I do remember learning BASIC in the 80's and it took ages for it to really settle in, so it's the same thing. But yeah, it would be nice if they had BASIC syntax. I'm converting a game over from 1991, which was written in BASIC, long before visual or objects or anything like that. It was pure spaghetti and I was younger and less patient, so my program is an absolute unreadable mess. My plan was to convert it to a modern language, all nice and neat but PHP looks exactly like my 1991 program, only worse :p

    But I believe this is the way the programming world is headed and at least we have C2 to make the front-end UBER easy, which would be the hardest part. I just need to learn PHP and build the 'guts' of the game in that but it'll be a while before PHP sinks in methinks

    Thanks, as you say, it's currently running all of the 'if' statements, I'll change to ==

farflamex's avatar

farflamex

Member since 7 Oct, 2012

Twitter
farflamex has 15 followers

Trophy Case

  • 12-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x2
    Popular Game One of your games has over 1,000 players
  • Famous Game One of your games has over 10,000 players
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies