How do I set three different upgrades in a survivor-like game?

0 favourites
  • 3 posts
From the Asset Store
Space Survivor is a casual game, the objective is to dodge obstacles and stay alive to reach the highest possible score!
  • Hey you beautiful scripters:)

    I'm working on a little game that should include an upgradesystem like for example Vampire Survivors. So you get to a defined score, game pauses, the upgrade layer appears and you can choose one of three upgrades.

    So I've got three Sprites (UpgradeOne, UpgradeTwo and UpgradeThree) with one-framed animations called "Multishot", "BiggerShots" and "Frequency". All three Upgrade-sprites shall appear on the pause-screen with random animations but never show the same animation as one of the others.

    Now I try to tell the system that if UpgradeOne appears, it shall set the animation to choose("Multishot","BiggerShots","Frequency"). The same for UpgradeTwo if it appears, but if the UpgradeTwo.AnimationName=UpgradeOne.AnimationName or UpgradeTwo.AnimationName=UpgradeThree.AnimationName, it shall choose again. Same for UpgradeThree and in the end there should be three different animations.

    I've thought that would be an easy task to solve (and I'm still sure it is and I'm just having a big brainknot) but somehow I get various kinds of results but not what it should be.

    Any idea to solve this would be great, maybe even a screenshot of an exaplescript, that would help a lot:)

  • I can share how I did it in my game. num is to identify the 3 upgrades 1, 2 and 3, left to right. The perkID is to assign an upgrade to that slot. Note I am using 3 instances of the same object, not different objects, if you are using 3 different objects then you can instead use these than using the num variable (i think you can safely just use one object with a var though since each of your three objects has the same animations)

    The advanced random permutation table is useful as it scrambles a load of numbers so if you have 6 upgrades it will shuffle 1 to 6 i.e. 4,3,2,1,5,6

    Then on your object where I set perkID variable to the positions of the permutation table you could instead set the animation frame to the same value. So in the table i mentioned above your upgrades would be set to frames 4, 3 and 2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Works fine, thanks a lot:)

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