Just wondering if anyone has suggestions on how to write this:
I want my character to be able to damage different types of enemies the same amount. It seems really inefficient to write specific damage statements for each individual enemy i.e.
punch()
if enemy1 is punched then
damage enemy1
end
if enemy2 is punched then
damage enemy2
end
end
if there a more logical way to write this that doesn’t require writing separate statements for each individual enemy?
Would it better to include that code with the enemy section of the code rather than the punch itself ie
enemy1()
create enemy1
move enemy1 towards character
if enemy1 is punched then
damage enemy1
end
end
enemy1()
create enemy2
move enemy2 towards character
if enemy2 is punched then
damage enemy2
end
end
Or is there an entirely different way to write this? [import]uid: 10903 topic_id: 6853 reply_id: 306853[/import]