dmakinde's Forum Posts

  • You can't generate variable names dynamically. You could use an array or dictionary for your data.

    Ah I see, thanks

  • Thanks, but I think I phrased the question incorrectly. Let's say that object.variable1 = "apples" and object.variable2 = "oranges". I am trying to use a for loop to process through object.variable1-4 in a way that I could say object.variable&indexloop would reference the data inside each variable, so on the first loop it would handle "apples" and in the second loop it would handle "oranges" and so on and so forth.

  • Hey all,

    I am attempting to perform checks on a sequence of string variables, for argument's sake let's call them object.variable1 - 4.

    I am trying to check through these variables in a for loop where the loop index serves as the number next to the variable. Is there a way to accomplish this? I tried to do reference something along the lines of

    object.variable+(loopindex+1)[/code:12h13u1e] to get construct2 to print the data inside object.variable1, but as you can imagine, I was met with the error "'variable' is not an expression in object". 
    
    Is there a correct way to do this? 
    
    Cheers all
  • for your particular example, you will do:

    local static var sum = 0

    For

    >> from 0 to tokencount("1+2+4","+")

    >>>> Add to: sum: int(tokenat("1+2+4",loopindex,"+")

    Thank you! This worked perfectly

  • Hi all!

    Is it possible to have the contents of a string variable used as a calculation? For example if I had a string that read "1+3+4" is there any way that string could be processed to express "8"?

    My string is generated through a combination of RegexReplace and replace scripts (

    replace(RegexReplace(testObject.inputVarOne,"([[a-zA-Z][a-zA-Z0-9]*,?)","g",""),",","+")[/code:yvh8elm2]) eventually turning a string of values into something more akin to a mathematical formula like the one shown above. Is there a way to turn that outputted string value into a calculation that construct2 can read 8 instead of 1+3+4?
    
    ---- update
    
    Here is what I have attempted so far: 
    I have created a string variable and set it to the above formula, meaning the string value is literally "1+2+3" I created a second, number variable and set it to the test variable I just made, and unfortunately instead of outputting "6" as expected, it simply output "1".  Can anyone offer any insight?
  • Hi all!

    I am trying to write a script that loops through all the tiles across the x and y axis , attempting to find a particular tile, and I'm trying to make this script reusable for multiple tilemaps. The way I had approached it was by making a for loop where the start index is 0 and the end index is the width of the tilemap/32 (ending with a result that steps through each tile one by one), then creating a local variable that increments with each loop. While this works, I suppose it also means that when drawing the tile maps, I have to be very precise about the size, which is a bit of a tall order for the particular project I'm on as that would mean going back and tweaking the width and height of a lot of preexisting tilemaps. I was wondering if there was a simpler solution to do this involving some sort of attribute that already does this for me?

    Thanks all

  • Hi all!

    I've currently got a game working with the main character moving 8 direction movement behaviour. Control wise it does everything I want it to, the only problem is the rate of acceleration and deceleration throws off the pacing of the game.

    Right now I've set the max speed to 400 and set both the acceleration and deceleration to a high number as I thought that would help it achieve max speed instantly, but there is still that slight speed up and slow down. Is there any way to fix this?

    Thanks for reading

  • Found the solution! I turned out to be caused by a massive tiled texture image I used as a placeholder. Deleting to from the project solved it

  • Hey Ashley, I did some more experimenting and after consulting Construct2s own guide on optimising games for mobiles I realised I made a rookie mistake: one of the placeholder art assets I was using was a massive background image that I implemented as a tiled texture until the artist I was working with could produce something for me. Deleting that image from the project caused the game to run perfectly I'm still confused as to why it worked when using the launcher from the cocoonjs zip but not on the APK but I guess that has something to do with the way things are loaded. Ah well haha lesson learned. Thanks for the assistance none the less!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey Pixel, it turns out that the root of the problem was indeed linked to the art assets. I predicted that the problem was most likely rooted in a rookie mistake on my part and that was certainly the case! I had a placeholder tiled background that was way too big. After deleting it from the project and recompiling the project ran without a hitch haha, it's always the complicated problems that seem to have simple solutions! Thanks

    I haven't tried recompiling it on crosswalk yet but it seems to be running just fine on cocoonjs so I won t worry about that for now

  • my mistake, I meant a signed APK rather than unsigned!

  • Hi Guys,

    I've been working on a project for a few weeks with the intention of releasing it for android with the CocoonJS wrapper, but I hit a brick wall with it and after not being able to find a solution (I'm sure you'll be able to find my previous posts around here) I've decided to give up and try using crosswalk. I would just like to know if there is a way to test out my apps without streaming them over wifi? I would like to see how the game would work as an APK.

    When a project is compiled on CocoonJS, you are supplied with both a signed and unsigned APK and I used the former to test the game on my device (that is also how I discovered my unfixable problem), does Crosswalk feature a similar function? Also while previewing my game over WiFi I noticed that the game's orientation wasn't locked. My game is designed for landscape screens, is there any way to achieve this on Crosswalk? Finally I noticed that there was a status bar at the top of the screen that interfered with the game's UI. Is there any way to get rid of that?

    Thanks guys

  • Hi Remus, I tested the game out using crosswalk and it seemed to work (albeit at a much laggier rate) but I must admit, I'm not very familiar with the wrapper so I'm not really sure how to do basic things like deploying a signed apk to test on my mobile or get rid of the status bar to make it feel like a normal game (if resources exist on how I can do that, please point me in the right direction) and given the fact that the game works fine on the cocoonjs launcher and not on the APK I'm not sure if there's a compatibility issue with crosswalk. If anyone wants to take a look and see the problem for themselves here is a link to the Capx, the CocoonJS signed APK and the CocoonJS zip.

    https://drive.google.com/folderview?id= ... sp=sharing

    If anyone can take a look and help me diagnose the problem I would be so grateful!

  • I don't think the recognition is the issue here, the clicks are definitely being detected, it's just something is going wrong whenever the game attempts to switch layouts. Never the less I changed the play button on the main menu to a sprite and still no dice

  • Hi All,

    I've been working on a game meant for mobiles and it has been going well up until recently when I tried to test out the APK. Much to my dismay I found that while the game worked fine on my browser, It wouldn't get passed the main menu as an APK on my Android device.

    I initially attempted this using CocoonJS, and while the game worked amazingly on the launcher from a zip file, the game would not switch layouts when being launched as a signed app. At first I thought perhaps it was just a bug with the layout so I recompiled the app making the default screen the actual game rather than the main menu layout. The game launched and played fine, but when attempting to navigate from the game to the main menu (through the pause screen/quit button) or even restart the game, it didn't work <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    Strangely enough I found that the layout it was stuck on was perfectly functional allowing me to resume and keep playing the game, it just refused to do anything revolving around switching layouts. I thought maybe there was a bug with CocoonJS so I made a simple dummy project with two layouts and button that toggled between the two, and that worked just fine so that got me thinking that perhaps there was something fundamentally wrong I was doing in practice that perhaps caused the game to overload or something such as a rookie mistake with the way I handled my events? This is my first mobile game project so I guess having it go smoothly would be too much to ask!

    After asking around on the forums I was suggested to ditch CocoonJS and use Crosswalk instead, the only issue with that is that that wrapper seems to have it's own problems; I can't seem to lock the orientation to landscape, the anchoring seems a bit screwy and the game runs extremely slow <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    Can anyone offer any assistance? I really want to keep this project going but right now it has hit a complete standstil!

    Any help would be appreciated.

    https://drive.google.com/folderview?id= ... sp=sharing

    Here is a link to the Capx if anyone would care to take a look, as well as the cocoonjs zip and signed APK if anyone wants to try and reproduce the issue.