Hello, I am new to programming, I am trying to create a game that when I press 1, i am changing location of actorA, press 2 change actorB and so on. Should I create 4 different class for each actor for simplier programming or create 1 class and use interface to command each actor?
You make one class which responds to commands ( given parameters ), and drag 4 copies of it into the map ![]()
What @ClockworkOcean said + no interface needed if just changing transform.
One Actor.You can use getallactorsofclass node in blueprints. you can use get or you can rename all of these actors in world hierarchy and you can make array with discover on spawn and instance editable. You can assign all of actors with its name or you can make four variables with same properties as array too and you set actor location and actor input is variable
?
thx all, i just notice i can rename the actor after pulling them to the world.
Another question, the actor’s new location is provided by my controlling pawn. For example, i press 1, and then do a trace channel, then actorA will change to the hit result point. How can I move the actor by it’s name when only create 1 class
oh, i can just compare the array with name after get all actors since i have their names already. Thanks all !!
One class, I do this for different types of enemies(base,ranged,heavy, ect …) one class represents many varieties of enemies that have their mesh, level, and other attributes get set on spawn based off of data tables