Search found 7 matches
- Sun Mar 20, 2022 7:11 pm
- Forum: Support and Development
- Topic: Indexing a 2D array results in highest member of that array error
- Replies: 3
- Views: 2120
Re: Indexing a 2D array results in highest member of that array error
I found the problem. I was using middleclass.lua in order to handle classes, and TileTable was being filled up by an alternate constructor for the class Tile. This appears to cause a mess of problems. If you're using middleclass, just bite the bullet and use the same constructor.
- Fri Mar 18, 2022 10:46 pm
- Forum: Support and Development
- Topic: Indexing a 2D array results in highest member of that array error
- Replies: 3
- Views: 2120
Indexing a 2D array results in highest member of that array error
I was working on a pathfinding system in a 2D tile grid when I noticed that the following function is ALWAYS returning tiles with the coordinates 26, 15. -- Find Orthogonally Adjacent Tiles --- Returns an array containing the north, east, south, and west tiles --- to this tile. --- North is indexed ...
- Mon Feb 07, 2022 8:20 pm
- Forum: Support and Development
- Topic: (SOLVED) Objects of the same class are getting changed to the same object
- Replies: 3
- Views: 2270
Re: Objects of the same class are getting changed to the same object
Solved it! For some reason, building being a subclass of entity made it to where a new building call affected all buildings. By separating building and making it its own class and putting it in the same file as its data, the buildings are now their own objects.
- Sun Feb 06, 2022 7:23 pm
- Forum: Support and Development
- Topic: (SOLVED) Objects of the same class are getting changed to the same object
- Replies: 3
- Views: 2270
Re: (Middle Class) Objects of the same class are getting changed to the same thing
Yes. On second though it'd probably be better to not nest the entity draw. Thanks for pointing that out!
You'll find a lot of this code is... not great. Hence the buildings all changing.![ROFL :rofl:](./images/smilies/ms-rofl.png)
You'll find a lot of this code is... not great. Hence the buildings all changing.
![ROFL :rofl:](./images/smilies/ms-rofl.png)
- Sun Feb 06, 2022 7:06 pm
- Forum: Support and Development
- Topic: (SOLVED) Objects of the same class are getting changed to the same object
- Replies: 3
- Views: 2270
(SOLVED) Objects of the same class are getting changed to the same object
Hi there! So, I have function call to construct a building on a selected tile. Each tile has an entity variable, and an entity can be initialized as a building (as a subclass of entity). However, when I build a building on a selected tile, all previous buildings turn to the building type I choose. S...
- Sat Feb 05, 2022 2:13 am
- Forum: Support and Development
- Topic: (SOLVED) Nil Value from something that shouldn't be nil...
- Replies: 3
- Views: 2491
Re: Nil Value from something that shouldn't be nil...
That was it. Thank you so much!
I can't help but express incredible anger at the amount of time I spent when it was just a typo...
I can't help but express incredible anger at the amount of time I spent when it was just a typo...
- Sat Feb 05, 2022 12:57 am
- Forum: Support and Development
- Topic: (SOLVED) Nil Value from something that shouldn't be nil...
- Replies: 3
- Views: 2491
(SOLVED) Nil Value from something that shouldn't be nil...
Hey there, newie lua-er here! I'm using middle class to help with some OOP stuff, as that's how I like to program. However, I'm having some problems with it. I'm using an array to hold a bunch of tile objects. When I try to get the sprite variable out, it returns a nil value. I'm perplexed as to why...