MoscowModder's Forum Posts

  • This is driving me crazy. I have a "sophisticated" storage system that seems tidy in theory but in reality introduces a lot of bugs.

    This is all of the player's data, scattered around several objects:

    * Player: Health, ammo, etc; resets every level

    * PlayerStats (Global Dictionary): Equipped items, number of upgrades, current money; saved to WebStorage as JSON every level/change

    * BoughtItems (Global Dictionaty): Which items have been bought in the store (only one per category can be equipped; that's saved in PlayerStats); saved to WebStorage after every purchase

    * LevelScores (Global Array): Highest score on each level; saved after every level

    * LevelStats (Global Array): Current in-level stats (kills, damage, etc) used to calculate your score. NOT saved to Webstorage.

    Is this a good way to manage a large assortment of data? Or is there a better way to keep track of all these numbers?

  • Wow, that was amazingly simple! Thanks!

    EDIT: Bonus question: how do you save objects to a JSON file (or multiple, but preferably one) and load them from said file to transfer save files between computers? Or better yet save them to Dropbox?

    EDIT 2: Never mind the Dropbox; I think the plugin for it should be simple enough when I want it. How about basic save&load to/from file, though?

  • I have a global Dictionary in my project that I want to use to track statistics like current money count, number of HP upgrades, etc. I also want to save these values to WebStorage.

    I want to:

    1) Load values from Local Storage when the global Dictionary is created

    2) Save values from Dictionary to Local Storage when they are altered (or at the end of a level)

    How can I do this? Is a global Dictionary the best way to go?

  • Well, I guess that works. Thanks!

  • In my game, I need to be able to send data pertaining to your score (killcount, time, etc) from one layout (the level) to another (the scoreboard). Is there a way to pass a variable or array like this, or will I just have to use global variables for all of them?

    Thanks!

  • Oh, awesome! Thanks!

  • I would like to save data (currently a high score but later stuff like stage-specific scores, inventory, etc) in my game, but also release it on multiple platforms. The trouble is, web apps use LocalStorage, and Win8 apps use the Win8 object, so it seems like I need to use something like this:

    Create default score:

    If HTML5 ...

    If Win8 ...

    Load:

    If ...

    ...

    Save:

    ...

    ...

    Does it have to be that complicated, or is there a unified method to save/load no matter what the platform? And I'm not talking about saving/loading the game's state - I'm talking about scores and inventory and stuff.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I knew that...

    So yeah, thanks.

  • I just updated because GenkiGenga's example was made in r133. UGH.

    I'm still pretty clueless on this problem. HALP.

    Edit: Wow! Found the problem. The bullets were being created to an invalid layer, so the game must have picked all bullets instead of the non-existent not-actually-created ones.

  • Oops, didn't finish uploading before I shut my computer. Should work now.

  • Yeah, mine is set up the same way as yours.

    Here's my .capx, minus the Pause and Function objects: dl.dropboxusercontent.com/u/811222/temp/CiS2NoPause.capx

  • However, the System Create Object action will apparently also pick objects, specifically the object it just created. So, if you properly placed a create object bullet action right before your set angle bullet action, then it should only apply to that created object.

    That's what I thought, too, but it doesn't work for me.

    You can see my CAPX file at https://www.dropbox.com/s/n4ugzwygz346xqk/CiS2.capx, event sheet "Common enemies", groups "Copter" and "Tank", and also sheet "Global", group "Gun". In the preview mode, enemy bullets re-aim at you and occasionally (not always) your gun turns enemy shots around too.

    Edit: I'm spawning the bullets with Enemy->"Spawn another object".

  • But how do you put the "set angle" part within the "spawn" part? I currently have it immediately below in the same event.

  • It's below. How do I make it within? It can't be in the bullet's "On create" because different enemies fire bullets differently. I could make several different bullet objects, but I'd rather not if I don't have to.

  • In my game, I use the following series of actions to fire bullets (both the player and enemies):

    (Object) spawn Bullet

    Set angle toward target (either player or current direction)

    Set damage...

    The trouble is, the Set angle action doesn't seem to care which bullets it chooses. For example, one enemy that shoots bullets aimed at you will aim all bullets on screen at you every time it shoots. How do I make it only select the shot it just fired?