Skip to main content
5 events
when toggle format what by license comment
Aug 9, 2016 at 20:14 comment added rvalerio Regarding AI, it can make it easy later. If you have something that expresses intention to do an action, like that UserControlsComponent, then an AISystem only has to work with these, and change them accordingly as you need. You should then be able to interchangeably use either an AIComponent or PlayerControlledComponent to make a character move.
Aug 9, 2016 at 20:12 comment added rvalerio Later on, when you feel more comfortable with ECS, you will find that in fact the Weapon can have a PlayerControlledComponent, where you can define a key to use it, and whenever you press that key, it tries to execute, leading to you being able to remotely use an object like a turret, robot, etc. But let's not jump into this just yet, make it simple, make an object to hold intentions to move (boolean left, right, up, down, jump, fire1, etc) and go from there.
Aug 9, 2016 at 20:12 comment added rvalerio Well, that depends. I suggest you keep it simple for now, and also make the weapon not aware of UserControlsComponent. When you iterate through the UserControlsSystem, and if fireWeapon = true, then you can set a flag on the player weapons to shoot, for example, shootMe = true. When the WeaponSystem iterates, it can check if the cooldown is over, if there is ammo, etc etc, do everything related to the weapon.
Aug 9, 2016 at 7:36 comment added ronscript I love your idea!, I am now trying to implement/revise my system, Can you give an example on the character & gun, because I have a doubt in the future that when I add an artificial intelligence, the state-machine will be implemented too. Also should the weapon be controlled by the UserControlsComponent or only the character?
Aug 8, 2016 at 22:18 history answered rvalerio CC BY-SA 3.0