r80 PhoneGap sub-event bug

0 favourites
From the Asset Store
14 amazing sound files of game events like Level Ups, Level Completes, object spawn, object taking etc.
  • I've exported a project to PhoneGap and when I launch the apk most of my sub-events are ignored and just don't trigger.

    All works fine in the 'run layout' preview, it's only when I export the project for PhoneGap and complete the build that sub-events are ignored - it's as if they no longer exist. I've also tried exporting without minifying the script, but same thing happens.

    I'll create a mini version of my game and post here to demonstrate the problem.

  • Stripped everything down to one layout and event sheet with a few events and one sub-event, but now it doesn't even launch as an apk after PhoneGap compiles, I just get the white pre-load screen on my Samsung Galaxy S2. Still all works fine in the 'run layout' preview.

  • OK, definitely the sub-event that's causing problems with PhoneGap. I've just deleted the only remaining sub-event, exported for PhoneGap and pushed it through PhoneGap build. Now that the apk has no sub-events it runs as it should.

  • Probably linked with the reported other bug, this has surely something to do with the recent changes made to subevent handling.

    Ash will probably issue a new release soon when fixed.

  • Is this still an issue in r80.2?

  • Is this still an issue in r80.2?

    I can't check it till tonight, but will let you know as soon as I know. Very much looking forward to having sound in the apps I create with PhoneGap!!!

  • Ashley r80.2 doesn't fix the PhoneGap problem with sub-events. I've tried with and without sound files (just in case) and neither way works, sub-events just won't trigger. <img src="smileys/smiley6.gif" border="0" align="middle" />

    ...on the plus side, sound is playing!

  • What sub-event is it that you think is the problem? Can you reproduce in a new .capx and share that?

    Given that sub-events are a very basic and crucial part of Construct 2, and there aren't any other reports of subevents not working in PhoneGap, I would suspect it is not actually the problem, and only appears to be working like that. Do you have any other ideas?

  • I'm going to build a new .capx now and if it doesn't work I'll upload it here.

    I can't think what else it can be other than something in the sub-event handler. This is a project I've been working on since December and have pushed through PhoneGap numerous times with other C2 releases without this problem. I'll start something from fresh and see what happens.

  • OK, had a bit of a play and created some new .capx files and most sub-events seem to be working now in r80.2.

    It looks like it may only affect sub-events that are referencing a global variable. I'll have a think about how I can build this into a simple layout and post up.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ...nope, it isn't that either!!! I'm narrowing it down now - looks like it's something to do with sub-events that reference a global variable that links through to a WebStorage value...

    Hopefully I'll nail it soon.

  • Ashley - Got it! It's when using the webstorage facility - that's what's causing the problem. It also does it in the preview mode, but I hadn't cleared my appcache before, so that's why it seemed to be working.

    I've put together a quick capx here: http://dl.dropbox.com/u/58315465/2012-02_BugTest1.capx

    I hope this capx explains it. Basically, when the character gets through the exit hole it should restart the layout, but I think something in the webstorage is now stopping it creating the value. I now don't think it was the sub-event that was the problem in the first place, I just happen to have webstorage events in my sub-events.

    ...I think I've created the capx the right way to show what's going on... essentially this is a roughcut of what is happening in my main project

    Let me know if you need anything else, Ashley. Look forward to hearing your take.

  • You have to cast the webstorage's value.

    By default, it is a string, and on start of layout you assign a string to a number.

    Result, gametest will probably be 0 the whole time.

    On start of layout add a int().

    Also on event 7, you litteraly save the value "gametest" (and not the value OF gametest) as it is written in between quotes (string).

    Finaly you have to consider that the first time that you run your game, the webstorage is empty.

    Assigning its value on stratup will end up by giving you a value of 0 for gametest.

    Here's a corrected and working capx

    I changed the name of the webstorage key ("save_gametest" to "saved_gametest" as the first one was filled with a "gametest" that made the rest of the code not work).

    The only bug was in the code, sorry.

  • Thanks Kyatric, I made a few errors in my example that aren't in my main game - it's been at least a month since I've written anything for web storage, so I'm a bit rusty.

    I don't have the 'int' in my game, so I'll add and see if that sorts it.

    It's been working the same way for at least the last three or four releases.

  • Yeeeeeaaaaaahhh!!!! Looks like adding "int" in front of the webstorage has got my game working again.

    I've no idea why it used to work without the 'int' and now I need to include it to make things run. My game's been working the same way perfectly for some time and I have apps on the android market running that way with no problem.

    Many, many thanks for helping me get this sorted, Kyatric, and apologies for the mess I made of my earlier capx example (not sure why I used a value of '1' as an example - all the initial values on my main game are '0', and I don't have the unwanted speech marks in the main game either).

    Really appreciate you getting to the bottom of this <img src="smileys/smiley20.gif" border="0" align="middle" />

Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)