self.physics.fixture and now i corrected the check for b to also be self.physics.fixture
Problems when using world callbacks[Solved]
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- NoreoAlles
- Party member
- Posts: 107
- Joined: Mon Jan 03, 2022 5:42 pm
Re: Problems when using world callbacks[Solved]
"Why do they call it oven when you of in the cold food of out hot eat the food?" - Jon Arbuckle
Re: Problems when using world callbacks[Solved]
As for the confusion between class and instance, as things are now you can't define e.g. two players, because you only have one table with both the method definitions and the instance data. Imagine you do the same with enemies; you could only have one enemy.
I may be wrong because I don't see your whole project, and it's possible that you've used a local Player variable for the class in player.lua and a local Player variable for the instance in main.lua or elsewhere. If that's the case, the only problem is that your naming convention confused me. But if you use Player for both the class and the instance, then the way you've defined things, you can't have more than one player.
A class is like a type, it defines how the variables of that type should behave. An instance (also called object) is like a variable of that type. So you typically define a class and then as many instances as you need. For a single player game, that would be just one player, but for enemies there are typically an enemy class and as many enemy instances, one per enemy.
Edit (per your edit): Are you checking `a` as well?
I may be wrong because I don't see your whole project, and it's possible that you've used a local Player variable for the class in player.lua and a local Player variable for the instance in main.lua or elsewhere. If that's the case, the only problem is that your naming convention confused me. But if you use Player for both the class and the instance, then the way you've defined things, you can't have more than one player.
A class is like a type, it defines how the variables of that type should behave. An instance (also called object) is like a variable of that type. So you typically define a class and then as many instances as you need. For a single player game, that would be just one player, but for enemies there are typically an enemy class and as many enemy instances, one per enemy.
Edit (per your edit): Are you checking `a` as well?
- NoreoAlles
- Party member
- Posts: 107
- Joined: Mon Jan 03, 2022 5:42 pm
Re: Problems when using world callbacks[Solved]
hell, i didnt. It now works flawless. I only checked for b ...
and about me only being able to have one player, i am starting to programm with courses on YT (not completly copying) and all that refactoring to OOP is brought up in the last episode i think. Also, i already have a Coin in the game, wich is done by metatables and some witchcrafty for loops.
"Why do they call it oven when you of in the cold food of out hot eat the food?" - Jon Arbuckle
Who is online
Users browsing this forum: Bing [Bot], glass2d, MrFariator, Semrush [Bot] and 90 guests