Closed a327ex closed 6 years ago
Man, I hope the next post comes out soon. These are really good, thanks!
@frarf hahah, same!
This series is awesome. It felt great when I did that exercise for the HP bar animation. Fascinating how something so simple can look so damn cool.
@frarf @snowcrshd I'm writing the rest of it first and then I'm going to release it all at once. Hopefully I'll be done sometime next month.
Would personally prefer it to be sooner, but since it's in summer, what the heck? Seriously though, these are awesome. Keep up the great work!
@SSYGEA thanks for the update 😄
Please take your time, this must be a hell of a lot of work to do.
Although I'm being an impatient twat, when can we expect new posts? Still, take your time, these are amazing.
@frarf Sorry, they're coming eventually, but it's taking longer than I expected and I also have been slower than I wanted to be. I'm not gonna make any promises about when anymore because I wasn't able to keep myself to my previous timeline, but the posts will be done and they will be posted all at once like I said previously.
Lookin forward to this!
Same here, can we know how many articles are left ?
@4-V-0-V
Same here, can we know how many articles are left?
I finished 10 articles so far and there are 5 more left.
Nice ! I can't wait to see them, your tutorial is one of the only to talk about game architecture, it already helped me a lot to understant it, thanks !
Might as well turn the posts into an ebook at this point 😛 Should be a good read!
Just wanted to chime in with my appreciation for your hard work on this series and my excitement for the next update. It has helped me a lot in getting up to speed with Lua and love2d, and understanding the systems necessary in a serious game build. Being a huge PoE fan, I'm also excited to see the finished product. The distorted vector aesthetic is visually addictive. Great work!
@SSYGEA
In the previous three tutorials we went over a lot of code that didn't have anything to do directly with the game. All of that code can be used independently of the game you're making which is why I call it the
engine
code in my head, even though I guess it's not really an engine. As we make more progress in the game I'll constantly be adding more and more code that falls into that category and that can be used across multiple games. If you take anything out of these tutorials that code should definitely be it and it has been extremely useful to me over time.Before moving on to the next part where we'll start with the game itself you need to be comfortable with some of the concepts taught in the previous tutorials, so here are some more exercises. If you can't do some of them it's fine, but it's important to at least try!
Exercises
1. Create a
getGameObjects
function inside theArea
class that works as follows:It receives a function that receives a game object and performs some test on it. If the result of the test is true then the game object will be added to the table that is returned once
getGameObjects
is fully run.2. What is the value in
a
,b
,c
,d
,e
,f
andg
?3. Create a function named
printAll
that receives an unknown number of arguments and prints them all to the console.printAll(1, 2, 3)
will print 1, 2 and 3 to the console andprintAll(1, 2, 3, 4, 5, 6, 7, 8, 9)
will print from 1 to 9 to the console, for instance. The number of arguments passed in is unknown and may vary.4. Similarly to the previous exercise, create a function named
printText
that receives an unknown number of strings, concatenates them all into a single string and then prints that single string to the console.5. How can you trigger a garbage collection cycle?
6. How can you show how much memory is currently being used up by your Lua program?
7. How can you trigger an error that halts the execution of the program and prints out a custom error message?
8. Create a class named
Rectangle
that draws a rectangle with some width and height at the position it was created. Create 10 instances of this class at random positions of the screen and with random widths and heights. When thed
key is pressed a random instance should be deleted from the environment. When the number of instances left reaches 0, another 10 new instances should be created at random positions of the screen and with random widths and heights.9. Create a class named
Circle
that draws a circle with some radius at the position it was created. Create 10 instances of this class at random positions of the screen with random radius, and also with an interval of 0.25 seconds between the creation of each instance. After all instances are created (so after 2.5 seconds) start deleting once random instance every [0.5, 1] second (a random number between 0.5 and 1). After all instances are deleted, repeat the entire process of recreation of the 10 instances and their eventual deletion. This process should repeat forever.10. Create a
queryCircleArea
function inside theArea
class that works as follows:It receives an
x
,y
position, aradius
and a list of strings containing names of target classes. Then it returns all objects belonging to those classes inside the circle of radiusradius
centered in positionx, y
.11. Create a
getClosestGameObject
function inside theArea
class that works follows:It receives the same arguments as the
queryCircleArea
function but returns only one object (the closest one) instead.12. How would you check if a method exists on an object before calling it? And how would you check if an attribute exists before using its value?
13. Using only one
for
loop, how can you write the contents of one table to another?14. Like I did for Nuclear Throne and The Binding of Isaac, break down the game Recettear in terms of rooms. Watch this gameplay video up to to 2 minutes or so (when the player moves on to the next level of the dungeon) to get an idea of most of the screens involved.
15. Break down the game Shovel Knight in terms of rooms. Watch this video up to the end when the overworld is shown (you can skip most of the gameplay in the middle) to get an idea of most of the screens involved.