i have here 3 examples how i did that.
now im not sure what is the best way to make this what are the conventions ?
https://pastebin.com/LZdcV1V6
-in the main.lua
using the new keyword directly after the require feels like the best(but could not work if i do instances in instances or ?)
-in the scenemanager
i make this in load and feels somewhat clunky
-in the playscene
i make it in the constructor and feels somewhat okay or good
how you do that ?
best regards
Lovingsoul1337
best way to require and make instances
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Citizen
- Posts: 61
- Joined: Fri Feb 21, 2020 1:26 pm
Re: best way to require and make instances
Functional programming = arrays
Object oriented - you have plenty of libraries that implement that, e.g. Hump class: https://hump.readthedocs.io/en/latest/class.html
Object oriented - you have plenty of libraries that implement that, e.g. Hump class: https://hump.readthedocs.io/en/latest/class.html
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
-
- Citizen
- Posts: 61
- Joined: Fri Feb 21, 2020 1:26 pm
Re: best way to require and make instances
i dont want a lib, i want know what is the best way or the convention to make instances. and showed 3 ways how i did that in my code and im not sure what is the best.
and ps. i want to do that on my own not using any lib at all for this.
best regards
Lovingsoul1337
and ps. i want to do that on my own not using any lib at all for this.
best regards
Lovingsoul1337
Re: best way to require and make instances
There is no right way. There are many ways and it's up to you to decide. You don't have to use any lib, but you can study their code and either copy that style or disregard it. Up to you.
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
Who is online
Users browsing this forum: Google [Bot] and 7 guests