Space Ape's Forum Posts

  • Audio > Stop All

    Take care!

  • Games

    Found this under 'Browser' in the manual:

    "Page is visible

    True if the page the HTML5 game is running on is currently visible. The page counts as hidden if the window is minimised, the page is in a different tab to the one being viewed, or on a mobile device when the app goes in to the background. When the page is hidden the game automatically pauses."

    I haven't used it, but it sounds like it would fit your needs. Add an event 'Browser - Page is Visible'; make your black overlay invisible for that condition and visible on an 'Else' condition.

    Take care!

  • alan349

    Have you already tried setting the character's Y-position when the wrap happens? Record Y, wrap, set Y--he should end up in the same relative position.

    I haven't used the wrap functionality too much, so it may be unavoidable. From your demo, assuming it's just wrap you're using, it definitely seems to reset the character.

    Try setting the X/Y position of the character in relation to the current viewport. Assuming the camera is following the character, that shouldn't affect the view at all. Sort of like manual wrapping?

  • AmpedRobot

    I set up a similar system in a current project and it works pretty good so far. There are 10 songs in the game; upon import, I renamed them to "1" through "10". The game starts and I call 'Play str(round(random(1,10)))...' and add a condition 'On music ended...' (or whatever tag you give the music) and the action 'Play...' with the same settings that started it off.

    I used a Function in this case; at the start of the layout, the music function is called to play the first random song; when a song ends, the Function is called to start a new random song.

    If you want to stop songs from repeating, add a variable that records the name of the last song played and compare it before starting a new song.

    Take care.

  • jambon

    Node-webkit seems the ideal solution for your project. I'm working on an offline game, as well, that requires storage.

    JSON data from user-created levels can be written to files with NodeWebkit. Set the path to the UserFolder expression or let them choose where to save it with a dialog--either way should work fine. You can then use WebStorage as a table of contents to index those saved files so the user can browse and find them, as required. If you want to avoid any pitfalls with WebStorage, save an index of user-created files (or whatever dynamic content) to the disk with NodeWebkit and then load that index file during the game. I.e. save a JSON file, such as an array or dictionary, that can by dynamically edited during the game.

    Likewise, with game states, the built-in save functionality can return a JSON string which can be written to disk with NodeWebkit. Using the save dialog lets the user choose where to save it, or you can use the UserFolder expression. No matter where the user chooses, you can access the ChosenPath expression to save the location of the file to an index (as mentioned above), so the game knows where everything was saved.

    Good luck, sir.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Greetings.

    After combing through the forums, I've exhausted all the suggestions on how to save a CanvasSnapshot to disk in node-webkit. When in a browser, the image will download just as any normal file without a hitch--same if it's opened in a new window.

    In node-webkit, whether windowed or full-screen, the download does not initiate. Also, showing the CanvasSnapshot in a new window doesn't enable any right-click 'Save As...' functionality. Saving the file to disk doesn't work, either, as node-webkit writes text to files.

    In the game, there is a simple camera button that takes a canvas snapshot and should allow the player to save that file somehow. No issues in a browser but node-webkit is defying every attempt to save it.

    If anyone knows of a way, or can find something to try, I'd greatly appreciate the help!

  • Will do, Ashley--thanks for the response.

    I made some changes last night and didn't get the error window. I was playing sounds with the regular 'Play' action from the Audio object when this was happening; I changed it to 'Play (by name)', allowing me to select the Sounds or Music project folder.

    I don't if it resolved it completely, but so far it's longer between seeing it.

    I was holding out for the next stable release, but this is happening often enough to warrant trying the beta.

  • Hey folks,

    I got a 'Alert' window while previewing a project; I've never seen it before and can't track down what it's referring to--anyone seen this before or have an idea what it is?

    Javascript error!

    Uncaught TypeError: Cannot call method 'tick' of undefined localhost/Audio_plugin.js, line 2575 (col undefined)

    EDIT: using release 146 (last stable) with no extra plugins beyond the stock ones

  • RookieDev - tulamide is undoubtedly correct; however, I was offering clearing the array as an alternative, not the best, method. I'd recommend just using one array and use the X coordinate of the array to determine which biome you're in. If forests are 1 and jungles 2, then 1, Y, Z is wide open for anything to do with that biome... use X as an index to tell the game which biome to use, then just switch that variable (such as a global variable) to tell the array to read a different X.

    Either way, best of luck, amigo.

  • wakkodrummer - I've had some funky issues using buttons and resorted to text objects or sprites. Glad you fixed it!

  • I would think using a single array would be best and just change the X coordinate to reference the biome or what-not. Multiple arrays mean more objects being loaded.

    I tend to use a single array and set the dimensions and references as needed without any noticeable drop in performance... unless you're talking 100s of dimensions.

    Maybe the memory management of C2 and arrays works differently, so I'm just guessing.

    Alternatively, you could use a single array, store the array in the Dictionary, and clear the array for a new biome.

  • Something like...

    Mouse > On Text Clicked > Set Text to str( round( random(1,5) ) )

    Should do just fine.

  • Silence is golden... but programming in it? Tough one--I'd hear my own thoughts! Gotta drown it out, just a bit. Sometimes silence makes me over-think a problem, which is awesome for meditating.

    Pink Floyd is ear candy for me, followed closely by Metallica, 311, and Celtic tunes.

  • Hey, folks. As far as I know, the idea is original... the execution is a work in a progress.

    "GROWsim", a medical marijuana caretaker simulation.

    Main grow room interface...

    <img src="http://4.bp.blogspot.com/-_BkgUYWKFZM/Unfu8T_mg2I/AAAAAAAAAR4/F5ZfxT5bzbg/s1600/00843-1.png" border="0" />

    New plant options...

    <img src="http://3.bp.blogspot.com/-I3rIwE9tzSs/Unfu-jSn0NI/AAAAAAAAASA/TuAmH7-kZ3U/s1600/00843-2.png" border="0" />

  • Hey there! Yea, I know this is a dead thread but I had to implement it for a game and found a simple solution. If it helps anyone looking, cool!

    I can whip up a capx if needed, but I think it'll be pretty simple to explain.

    For example, if the number you need to display is in a variable 'cash', follow these steps:

    1. Test to make sure the cash value is large enough

    Ex: if floor(cash/1000) => 1

    2. divide cash by 1000 and store the result in a separate variable like 'cash_thousands'

    Ex: cash_thousands = floor(cash/1000)

    3. subtract the thousands from the 'cash' value

    Ex: subtract (cash_thousands * 1000) from cash

    Note: it's probably wise to keep the original 'cash' value, the total for the game, in a safe spot and use temporary variables elsewhere.

    4. pad the remaining hundreds and ones and store in a text variable (we'll call it 'cash_display').

    Ex: set cash_display to cash_thousands & "," & zeropad(cash,3)

    Note: you can also just display the number variables directly with the comma, if needed.

    That's it. If you need bigger numbers, follow the same steps and make a cash_millions variable, dividing the original value by 1000000 and so on.

    If I goofed up, please call me on it... but I think this way is pretty simple.

    Thanks.