How do I make an fight system like Age of War?

0 favourites
  • 7 posts
From the Asset Store
A complete set of graphical user interface (GUI) to build 2D video games with rock / stone themes
  • Hello! I've been having a problem with a game I'm currently making (Golems: Battle of Titans). In the game I've tried to make a fight system that has my golem stop it's movement and attack the enemy golem when they collide, the same goes for the enemy golem. The first problem was that if my golem was defeated first then the enemy golem would start moving back to the enemy base. So I then got rid of the 8movement on the enemy golem and then gave it a custom movement. It all went great but now the golems don't seem to be damaging each other anymore and the enemy golem just keeps on moving forward. So I played around with it for a few days and now I've set up a line of sight for the golem and enemy golem. The golem works fine it stops when it sees the enemy golem and it plays it's temporary attack animation (I'm not sure if it actually does damage but eventually I'll be making collision boxes for it so it shouldn't matter) however the enemy golem is still moving forward and it only plays it's temporary attack animation once. They're both solids but I set the Line of Sight to only be blocked by the lines seperating each lane. So they should still be able to see eachother. I'm not sure why the enemy golem keep on moving forward. Can anyone please help me? If anyone knows how to code something like this http://www.addictinggames.com/strategy-games/ageofwar.jsp into Construct 2 please reply. If the .capx is needed I'll post it here.

  • Hi! You can use path-behavior, the starting point being the point they come from, end point the enemies/your base. When two going the opposite direction, they collide obviously. When they do, you stop all path-moving on all enemies and your soldiers. The colliding ones do the fight - which means, they are all standing around waiting for your fight algorithm to decide, which one to destroy - till one of the fighters die. As soon, as one dies, you can start path-movement again, till two collide... and so on.

    Basically the age of war is a kind of a turret-defence game but with own soldiers. Did you use that template to start with?

  • Thanks MultipleChoice for the quick reply. I'll try it out and see what happens. Also I didn't use Age of War as a template I just used it as inspiration for how each of the golems fight when they meet each other. The way the game plays is different from Age of War.

  • tjblazer85 How do your enemies/soldiers behave/move? That would be helpful to know...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Once you spawn a golem in either one of the five lanes they start moving forward, you can switch the golem to any of the five lanes near your base but it will stay in it's current Y axis. You can do this because later in the game you can combine golems to make a more powerful one, the 2 golem selected will be the new golem's position and lane. After the golem exits the highlited base area they cannot be switched or combined. When a golem sees an enemy golem, the golem will stop and start it's attack animation at the end of the animation the golem will spawn a colission box that comes in contact with the enemy that will then minus golem.attack by enemygolem.health. The same goes for the enemy AI and enemy golem AI. Ranged Golems have a longer range of sight and will shoot an object that can pass through allies and collide withe enemy. Ranged Golems don't move while shooting. The Same thing goes for the Enemy Ranged Golems. Everything about this works great except for the movement of the enemy golem. However with your solution I think it should be fixed.

    Edit: When a golem reaches an enemy health crystal they stop their movement. Once a lane's health crystal is destroyed the lane is now highlighted in blue and can the golem's switching and combining ability can be used. The lane also creates another health crystal for the player. When this is destroyed it restores the lane to it's original state and the enemy gets it's health crystal back. The new health crystal however is harder to destroy than a regular one. The enemy golems also do the same thing. The game is over when either side has all of it's crystals destroyed.

  • tjblazer85 Yeah, the basic principle seems to be the same Glad it helps...

  • MultipleChoice I've tried it and I've encountered a problem. They don't seem to move at all but after a long time they eventually start moving. Is there something I have to change? Like the cell size?

    Edit: Nevermind, I messed with it and now it works great! Thanks for the help!

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