drop afther each -1000 hp

0 favourites
  • 8 posts
From the Asset Store
1000 x 1000-pixel tile set sheet for your awesome 2d games
  • ok guys here is my problem

    i have an asteroid of 50000 hp

    now im mining him with mny laser but i want him to drop loots every -1000 hp ive reduced

    how can i do it

  • Add another instance variable to your asteroid object e.g. lootHP and set it to 1000

    In the event that you deduct hp from the asteroid add an action to deduct the same from lootHP

    Beneath that event add the sub-event : If asteroid.lootHP <=0 | asteroid spawn loot; asteroid set lootHP to 1000.

  • + Asteroid: Is overlapping BulletLaser

    ----+ Asteroid: Pick top instance

    -----> Asteroid: Subtract random(?100?) from Hp

    -----> Asteroid: Subtract random(?100?) from Hp

    + Asteroid: Hp = 0

    -> Asteroid: Destroy

    // To add - for every -1000 hp of the asteroid make him drop loots

    + Asteroid: LootHp = 0

    -> System: Wait 0.01 seconds

    -> Player: Spawn PowerUpsHP on layer "HPbar" (image point 0)

    -> Asteroid: Set LootHp to 1000

    its not working whats wrong

  • + Asteroid: Pick top instance

    -> Asteroid: Subtract 100? from Hp

    -> Asteroid: Subtract 100 from Hp

    ----+ Asteroid: LootHp = 0

    -----> Asteroid: Spawn PowerUpsHP on layer "HPbar" (image point 0)

    -----> System: Wait 0.1 seconds

    -----> Asteroid: Set LootHp to 1000

    this one either none are working

  • + Asteroid: Is overlapping BulletLaser

    ----+ Asteroid: Pick top instance

    -----> Asteroid: Subtract random(?100?) from Hp

    -----> Asteroid: Subtract random(?100?) from Hp

    + Asteroid: Hp = 0

    -> Asteroid: Destroy

    // To add - for every -1000 hp of the asteroid make him drop loots

    + Asteroid: LootHp = 0

    -> System: Wait 0.01 seconds

    -> Player: Spawn PowerUpsHP on layer "HPbar" (image point 0)

    -> Asteroid: Set LootHp to 1000

    its not working whats wrong

    You're subtracting from Hp twice (I guess you should once from Hp and once from LootHp).

    One more thing is that you use "random" two times – so a different number will be subtracted from Hp than from LootHp.

  • > + Asteroid: Is overlapping BulletLaser

    >

    > ----+ Asteroid: Pick top instance

    > -----> Asteroid: Subtract random(?100?) from Hp

    > -----> Asteroid: Subtract random(?100?) from Hp

    >

    > + Asteroid: Hp = 0

    > -> Asteroid: Destroy

    >

    > // To add - for every -1000 hp of the asteroid make him drop loots

    > + Asteroid: LootHp = 0

    > -> System: Wait 0.01 seconds

    > -> Player: Spawn PowerUpsHP on layer "HPbar" (image point 0)

    > -> Asteroid: Set LootHp to 1000

    >

    > its not working whats wrong

    >

    You're subtracting from Hp twice (I guess you should once from Hp and once from LootHp).

    One more thing is that you use "random" two times – so a different number will be subtracted from Hp than from LootHp.

    ^^^^^^^^^what he said

    use a global variable called 'damage' and on the event say, set 'damage' to random(range), subtract 'damage' from HP, subtract 'damage' from Loot Hp

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you could then go a step further and before loot drop, set global variable 'luck' to random(range)

    and then base your loot off of a random drawn number.

    so as beating the 1st boss you would have a luck range (or loot class range) of 0-3, where as beating the 4th boss your luck can range from 7-15 etc depending how big your game is, even if its just a small game you can customize loot per level

  • awwww my bad ty XD

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