can you have some fighting in your game?

Started by shaungaryevans, Tue 09/03/2010 22:37:02

Previous topic - Next topic

shaungaryevans

Thanks monkey_05_06,

right, so i know how to make the enemy follows the player and i have worked out how to maker the enemy hit the player so life goes from them. My next question is, how can i do it so if the enemy is going to hit the player, the player can put a shed up to stop this?

aedwards00

I'm really sorry for this, I know making fun of spelling/grammar is low, but put up a shed lol :P

monkey0506

Well it would really all depend how you want to perform the blocking (with the shed/shack/barn/storage unit/other structure (possibly a shield :D)). For example in your code for the enemy attacking you could do:

Code: ags
// logic to determine damage here
if (!IsKeyPressed(eKeyShift)) { // shift key is not held down
  stats[player.ID].HP -= DAMAGE_AMOUNT; // replace with whatever code you are using to store HP and such
}

shaungaryevans

lol, that would be funny, i meant shield

SMF spam blocked by CleanTalk