Question about my games optimisation [Solved]

Hey, I am a new scripter making a combat game. The way I have gone with it is I have made a lot of use of bool, string and Int values to transfer information across my scripts. For example, here is my Hitbox script with a bunch of values inside of it that an attack script can either tick or not to determine the behaviour of said attack so that I don’t have to code in the behaviour for each attack, like copy and pasting the knockback code for hundreds of different attacks, all I have to do in the attack script is to turn the bool value “hit” on and the IntakeScript will run :

image

I find this way easier than using a module as it will have massive amounts of arguments and too be honest, so far this is working fine and very smoothly, I just don’t want to waste my time finding out later down the line that this method is going to make me shoot myself in the foot when the game has more going on.

Why don’t you want to use modules? Modules are the way to go. Modules are so amazing! You should definitely use a module for this. You don’t necessarily need to have a massive amount of arguements.

1 Like

How will I avoid huge amounts of arguments, can I use the dictionary within the module to pass the values to the function?

Maybe try to use obeject oriented programing instead of passing the arguments like this
Stun(arg1,arg2,arg3,arg4)
You can do it like this

StunModule.Duration = 5
StunModule.WalkSpeed = 0
--Something like this
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.