- Home /
Monster & Player Attributes Script
Hello, i'm now working on Monster and Player behavior/attributes script, but i confused a bit.. so i creating a battle game, which is going through stages.. in stage 1 we face this monster, and stage 2 we face another monster, etc..
so is that better to create 1 script for every monster?
i mean my monster is all different, should i attach 1 script, (containing atk, hp, etc.) to every monster, or i should do global scripting, i mean all attributes for all monster, and change it manually, maybe on Inspector or else.
I used one script for all my monsters, they all have an instance Game Enemy, which inherits from Game Battler which is the class that handles hp, attack power, etc(Game Battler, im using it for my convenience). each monster has its own instance of Game Enemy.
this will allow you to have stages with multiple monsters, e.g stage 7 : 2 $$anonymous$$onsters. its more work if you keep a single monster instance then modify it each time a new monster appears.
this is a question that should go to the forums, though. since its really a discussion based on opinion rather than a straight answer.
oh, thanks fornoreason1000, sorry for posting on wrong place.. i just dont touch the forums so much.. but i'll do that..
so that after u create the Game Battler, u declare var hp, atk, etc. and u attach it on your monsters, and u change the parameter on Inspector right?
Yes, it either that or data basing(much more work, just imagine every time you need a monster, you will have to query the stage number/name then retrieve the values for that monster.). you change the variable in the inspector then save it as a prefab you can then instantiate that prefab.(or not if you monsters are already placed in the scene).
ic, and now im trying to figure out how my monster atk could affect my character hp, is that done with collision(i could only think the collision is only way to connect them)?
btw thanks for your suggestion :D
Your answer
![](https://koobas.hobune.stream/wayback/20220613123713im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Endless DeathZone??!!? 4 Answers
Action activates trigger. 1 Answer
Crouch jump bug. 1 Answer
Raycast Destroys player. 1 Answer