[SOLVED] Change AI Difficulty over time

0 favourites
  • 6 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Hey,

    I'm new to this forum, just registered and I've downloaded Construct 2 Free Version and I've fallen in love with it. Such an awesome software. I'm thinking of buying a License, because it's worth it.

    I'm in a bit of a pinch though. Let me explain.

    My game is a top view monster defense game, there's 2 different types of monsters.

    1) Monster. Has 2 Instance Variables, "Health: 4, and Damage: 2" Spawn every 5 seconds.

    2) Boss. Has 2 Instance Variables, "Health: 40, and Damage: 10" Spawn every 60 seconds.

    Now, every 60 seconds I want both the monsters to have increased difficulty, for example Monster to get 4 more health and 1 more damage.

    I did this as an "System -> Every X Seconds -> Monster Add 4 to Health" and so on.

    But that only works for the monsters that's allready spawned, the monsters that spawn after the 60 second mark has the basic attributes and are unaffected by the change.

    So how do I make the change in variables/attributes apply to the monsters that are about to spawn?

    I hope I made myself clear. Help is needed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you could do some global variables that will be increased as well and for new spawned monster, you add the count of that variable to the initial health.

  • But that only works for the monsters that's allready spawned, the monsters that spawn after the 60 second mark has the basic attributes and are unaffected by the change.

    Yes, that's for sure - it should work so. The monsters have after their creation the instance-values that are set in the object. You have to set the values for the instancevariables of them below the spawning in the eventsheet.

    quick example <img src="smileys/smiley2.gif" border="0" align="middle">

  • Thanks for the help, I'm starting to understand how it works. But what you sent me did not exactly what I was looking for, it did in a way though. Maybe I explained it a bit wrong.

    Your program creates another sprite of the same monster but with the bonus, and at the same time spawns the old one, without the bonus. If I follow your example, I'd have to make a new row for each upgrade.

    I just want to endlessly increase the difficulty every 60 seconds.

    NEVERMIND. During this post I made it work. I'll tell you how.

    I added a global variable "AddMonsterHealth = 2"

    And an Event that Increases "AddMonsterHealth" every 60 seconds by 2.

    And the monster that spawns, has it's own "Health variable" increase by "AddMonsterHealth".

    This works because the "AddMonsterHealth" Increases by 2 every second, and the "Health" variable in the monster is set by "AddMonsterHealth"

    I feel proud now. But I wouldn't have made it without your help Joe7, so thank you! :)

  • Make a Global Variable for every type of enemy, and instead of adding to the instance variables, add to the global variables. Then add an event that sets the instance variables to the global variables every tick.

    Global Variable SetMonsterHP = X
    
    Every tick:
    -> Set Instance Variable MonsterHP to SetMonsterHP
    
    Every X seconds:
    -> Add X to SetMonsterHp
    
    

    Edit: Ah, I see you beat me to it <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Haha yeah, but thank you anyway! :)

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