Best way to do it?

0 favourites
  • 6 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • I n my ship game i have 8 types of ships and each type has the current variables:

    fire speed




    All those variables are numbers that the player unlocks for each type of ship, but the player can change type of ships in the game .. so each ship will have diferent atributes...

    Each ship are diferent animations from the same sprite.

    What is the best way to do that? since instace variables are for one sprite.

  • If you don't want them as separate objects then you can define the 'type' with an instance variable ID. If type = 1, then other variables are x, y and z, if type = 2, then other variables are x, y and z etc. You can also define the animation in the same way, if type = 1, animation = "type1" etc.

  • I would just have one set of instance variables for your player object. When you change ship types, there is no need to keep the stats of all the other ship forms in instance variables.

    In the same action you change ships in, set the instance variables to the relevant ship's stats. I'd use an array to keep track of which stats are associated with each ship.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Both didnt understand what i am saying...

    i can upgrade diferent stats from diferent ships and when i change ship the upgrades are kept in the ship that i was using prior the new one and the new one will have new stats

  • If I understand correctly, you have 1 sprite that you simply change the animation to.

    If that is the case, you could store each ship in an array.

    Something like this:


    [ ship,fireRate,shield,speed,special]]

    which translates too:


    [ship1,10,5,5,none],[ship2,15,6,2,rapidFire]] and so forth.

    You can then persist this array with local storage.

    When a player changes ship, simply grab the right values from the array and apply it to your sprite.


  • Can anyone have a capx file with the example of how to load a array file into the game than update the file and then save on local storage???

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