Making a Battle Cats-like game.

0 favourites
  • 3 posts
From the Asset Store
Ninja Cats
$20 USD
A set of 4 professionally animated cat characters !
  • Hello everyone, sorry to bother you all but I am in really desperate need for help on a project that requires me to make a 2D Side-scrolling tower defense game, similar to that of the game Battle Cats by PONOS and I will need help with some components :

    1- How do I make a button, that when clicked, spawns an AI that moves with their own pathfinding (I've been able to script an AI that moves with pathfinding but it only works if they're already on the layout and I'm unable to spawn them and then they move because whenever I spawn them they stay static)

    2 - How do I implement a budget system that constantly counts up and spawn an AI with a price to deduct that increasing budget?

    3 - How do I make the AI move again after interacting? (If one AI encounters another AI and they stop to fight, but after one of them dies, how do I make them continue on their pathfinding to the objective?)

    4 - How do I implement a range system where an AI with a ranged weapon encounters an enemy and stops at a range of the enemy to attack?

    Thank you all very much, if you are able to help me with at least the first two, I am very grateful to you for saving me.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 1 - I would do this by giving the AI an instance variable called 'state' and on created set the 'state' to 'moving'. Then have pathfinding logic if AI state is 'moving'. This also helps with 3 and 4.

    2 - Have a global variable that counts up every x seconds. When you spawn an AI, subtract the price from the global variable

    3 - It depends how they are fighting, if it's done by overlap you can say if 'state' is 'fighting' and not overlapping an AI, then set state to 'moving' i.e. continue pathfinding

    4 - You could detect distance between ranged AI and an enemy or have an invisible sprite around the enemy and detect an overlap of ranged AI and the sprite, then stop pathfinding, set the ranged AI state to 'attacking' instead of 'moving'

    They are just generic answers and you will likely come across bugs because tower defense can be complex with the logic.

  • 1. There is a path finding condition that let you check if an object have a path or not, you can use this for newly spawned objects. So if they don't have a path they should find one.

    2. Not 100% sure I understand what you mean by this. But if I do, you can use a timer or a Every X second, that will increase the budget, Each time this happens you add a check to see if the the budget is high enough and if it is you spawn an AI and subtract a value from the budget.

    3. After one of the AI's kill another AI, you add a functionality in either "On destroyed" or whatever place you destroy AI's and then you pick the winning AI and make a action here for finding a new path. Alternatively you use a variable for triggering the finding a again path.

    4. You make a condition that any AI with a Range weapon, check every tick or every 0.2 second using Distance (X1,Y1,X2,Y2) Where X1,Y1 is the AI with the range weapon, and X2,Y2 is most likely the closest enemy AI.

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