Need combat help

Noob game maker here, how do you have basic combat in games? Some of my stuff has been copied from the zombie apocalypse tutorial, namely spawning enemies and giving them stats. I have the DoAttack function but what variables and/or parameters do you add to it to make it run? Additionally, how would you damage an enemy, say through a punch? Can I just make add the command "punch x" for it or would I need to create a whole new function or maybe an attribute? All the tutorials I've found cover RNG not set damage, so it's a little complex for me.


Io

There's a LOT of ways to do this. The way I handled it in my games is with abundant usage of Attributes. For example, in my Sci-Fi game, the player unlocks a Doubleshot ability early on, which is structured something like this:

Player.OutgoingDamage=Player.Damage

Player.Target=Whatever Enemy I Ended Up Targeting Through A Complex Mixture of Clones and Menus Since You Can Have Object Attributes

Player.OutgoingDamage=Player.OutgoingDamage-Player.Target.Armor

Player.Target.Health=Player.Target.Health-Player.OutgoingDamage

Player.Target.Health=Player.Target.Health-Player.OutgoingDamage

Hope this helps start you off!


player.hitpoints = player.hitpoints - this.attack
this.hitpoints = this.hitpoints - player.attack

That is one way.

This is the Pixie's zombie tutorial, if you are interested.
https://github.com/ThePix/quest/wiki/The-Zombie-Apocalypse-(on-the-web-version)


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums