Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
Got a shooting system working, uses 13 parameters so I wrapped it up with a function instead of using another dozen of instance variables (do not know if this is a good idea). Works if it is given numbers, but it does not if given function.param(number). I've read both entries in the manual and looked around, but I cannot figure it out.
I'd appreciate any help!
Capx: https://www.dropbox.com/s/jp6a7sn0w37bu ... .capx?dl=1
You shouldn't use Wait in a function, as the function will return immediately, and the parameters are lost. A Timer is the better way to do this.
Ugh... The point of the system was to avoid creating more instance booleans/variables and make it compact. Isn't there a more clean workaround? Making a timer seems messy. I'll try it out, anyway. Thanks, blackhornet
This is what I meant to do (I did it quite a while ago, but it works), with parameters instead of instance variables.
Develop games in your browser. Powerful, performant & highly capable.
That's what instance variables do - I don't know why you are fighting it.
Wouldn't having 20+ instance variables in 50+ instances constantly changing affect performance? This method made it more compact to design weapon stats too, but oh well ~
But those values have to exist somewhere, and I'd think passing 13 parameters to a function call would be more time consuming than accessing preallocated memory values. Seems like a minor thing to worry about.
https://www.scirra.com/blog/83/optimisa ... -your-time
Absolutely not at all