Ok, so I have very minimal programming experience and have literally just moved onto LOVE from Game Maker. I've been using the Wiki in addition to some of the simplest examples I can find on the Project/Demo board to get the most out of this however there is one thing that I can't figure out: Classes. Or, at least from what I've read, Lua's equivalent of them.
After I had looked over the Wiki pages I went straight into experimenting with code and produced a fake cube which I would've intended to use for something with graphics reminiscient of Disgaea (isometric in 3d with sprites for characters and enemies) only to realise I had problems with depth and no simple way of setting up several of these tiles simply (see the fakeCube.love attachment).
(Banter Ends Here)
I went on to try something more within my skill range; a scrolling shooter, where it occurred to me that I had read nothing in the Wiki that followed the same scheme as in Game Maker where you create an object (which is just a class) and then create and can spawn instances of that class which is the generally used way for going about having the ability to shoot. I looked into the use of tables which were suggested to other people with the problem and looked at other people's code but can't wrap my head around how to use them.
My question is this: How can I create and use something that follows the same sort of rules as a Game Maker object (or a 'Class' in main languages) to implement shooting or place several of those cuboids in the attachment without having many times the code?
(Main Point Ends Here)
Also, some information on the fakeCube.love files variables and layout for those interested (in code to save space):
Code: Select all
The white square is what I would call the 'top' of the cuboid. cubeX and cubeY are the coordinates for the middle of the 'top' square. cubeSize is the scale factor, where the maximum size were the scale factor 1 is 1 pixel along each axis (so the 'top' would be a 2x2 square at minimum) so 50 makes the 'top' square's maximum size 100x100. cubeRotSpeed is the speed of rotation for when you use the arrow keys to rotate the cuboid. I don't really know much about radians, just few of their uses and how to convert them so this value is just down to what I thought looked right when I tried the game. cubeD is the maximum cuboid depth in pixels. Basically, the middle section's maximum length no matter what angle you view the cuboid at. cubeDepth is how deep the cuboid should be rendered at the current angle. drawShade was just a quick way of setting the 3 shades of grey for the different parts of the cuboid. extraRot is the z-rotation I guess. It's basically the other direction of rotation but I've never thought about it in terms of being rotation on a z-axis so I don't really know if it is (just assume that it is until you see it used for something that makes less sense than the rest of the code) pointAX and pointAY to pointDX and pointDY are the coordinates for the 4 vertices of the 'top' square. pointAAX and pointAAY to pointDDX and pointDDY are the coordinates for the 4 vertices of the 'bottom' square. Those points are what I would want to make specific to each instance of a class. All the equations were pretty much just what thought might look good enough and if they did they were kept, so there's bound to be countless inaccuracies from what a real 3D render would look like.