First little project and general questions about LOVE

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Tamzaiy
Prole
Posts: 3
Joined: Fri Oct 17, 2014 9:59 pm

First little project and general questions about LOVE

Post by Tamzaiy »

Greetings everyone, I have just started to learn LOVE and I have created a very simple "game" where you must simply press a key corresponding to the key shown. Since I used the arrow keys for this, the key you must press is represented by up, down, left, and right.

As for the questions, does this code look alright, or am I doing something incorrectly that will lead to problems later?
Secondly, I am looking to create a top-down RPG/Card Battle game, would LOVE be suitable for this? (Tried RPGMaker, but ended up wanting to use another engine for this.)

I am uploading the .love file, mainly to see if I created it correctly and so the code may be analyzed.
Attachments
First_Project.love
(586 Bytes) Downloaded 106 times
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: First little project and general questions about LOVE

Post by Karai17 »

Welcome to our LOVEly family! <3

You can do all of the key checking code in love.keypressed instead of setting a flag and then doing things in update. It is also worth noting that you should use love.math.random as it displays consistent numbers across all platforms (this may be important for some games). Otherwise, you seem to be off to a great start!

LOVE is a very capable engine that can be used to create nearly any style of game. It is also open enough to allow you the freedom that many game makers do not. LOVE is not a game maker, it is a framework to make games. That being said, LOVE would be a great tool to create an RPG or card game.

Good luck!
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
Tamzaiy
Prole
Posts: 3
Joined: Fri Oct 17, 2014 9:59 pm

Re: First little project and general questions about LOVE

Post by Tamzaiy »

Thank you for the information, I moved all relevant functions to keypressed, and added a level system. Now I just need to find a way to add the tables so that a higher level has all the keys from the lower levels, and I need to add a timer to the game.

EDIT: I forgot to switch to love.math.random in the file I uploaded, but I did switch to it after uploading it.
Attachments
First_project.love
(670 Bytes) Downloaded 100 times
User avatar
nice
Party member
Posts: 191
Joined: Sun Sep 15, 2013 12:17 am
Location: Sweden

Re: First little project and general questions about LOVE

Post by nice »

Tamzaiy wrote:Greetings everyone, I have just started to learn LOVE and I have created a very simple "game" where you must simply press a key corresponding to the key shown. Since I used the arrow keys for this, the key you must press is represented by up, down, left, and right.

As for the questions, does this code look alright, or am I doing something incorrectly that will lead to problems later?
Secondly, I am looking to create a top-down RPG/Card Battle game, would LOVE be suitable for this? (Tried RPGMaker, but ended up wanting to use another engine for this.)

I am uploading the .love file, mainly to see if I created it correctly and so the code may be analyzed.
Hey welcome to the community!
feedback to your first project: if you want to add some more difficulty to your game I think you should add a some sort of timer so that the player won't have all the time in the world.

You're off to a good start but here's a piece of advice from me:
Like what you did with your first project (I have no idea how vast your programming experience is) start with small projects, maybe some type of games that focuses on different aspects and functions of Löve2D.
And making a rpg might be pouring a little water over yourself (Some might have different opinions about this but this is mine opinion) from what I understand there's a lot of balancing involved so there might be a lot of fine tuning that will take some time to do..

My suggestion would be that you take an old game (like Tetris) and make something that's different to what Tetris normally is and what that can be is up to your imagination.
I will add one of my old projects which is my take on the classical Asteroids but my twist to it.

I hope that I will see more from you!
Attachments
spacevoider.love
(169.05 KiB) Downloaded 97 times
:awesome: Have a good day! :ultraglee:
Tamzaiy
Prole
Posts: 3
Joined: Fri Oct 17, 2014 9:59 pm

Re: First little project and general questions about LOVE

Post by Tamzaiy »

Ah a project to look at, thanks for sharing! Also about the timer, I do plan on adding one, still tweaking the project (the one I last updated is severely out of date.) I do have a couple of more questions.

About libraries, would it be good to implement libraries in my first few projects? I know they make some things a lot easier but I'm wondering if it might be better to try to do things on my own at first.

Are there any programming practices I should try to avoid now so I don't develop bad habits? I know to stay away from global variables as much as I can, to comment code thoroughly, and to avoid "magic numbers".

I do like the idea of trying to recreate classics and modifying them, I think once I finish this first project I'll work on a vertical side-scrolling shooter.
User avatar
nice
Party member
Posts: 191
Joined: Sun Sep 15, 2013 12:17 am
Location: Sweden

Re: First little project and general questions about LOVE

Post by nice »

Tamzaiy wrote:Ah a project to look at, thanks for sharing! Also about the timer, I do plan on adding one, still tweaking the project (the one I last updated is severely out of date.) I do have a couple of more questions.

About libraries, would it be good to implement libraries in my first few projects? I know they make some things a lot easier but I'm wondering if it might be better to try to do things on my own at first.

Are there any programming practices I should try to avoid now so I don't develop bad habits? I know to stay away from global variables as much as I can, to comment code thoroughly, and to avoid "magic numbers".

I do like the idea of trying to recreate classics and modifying them, I think once I finish this first project I'll work on a vertical side-scrolling shooter.
I'm not very familiar with libraries myself as I have just implemented a type of library myself but my suggestion is to start small and work your way up, don't rush it and try to learn how different functions in Löve works but my suggestion is to start small and work your way up, don't rush it and what do they say? easy does it?

Some of my learning with Löve
1. From what I learn from my experience with Löve is that always when you write a new function like a:

Code: Select all

function love.draw()
always put a end to it like this:

Code: Select all

function love.draw()
end
That was a bad habit that I had when I was learning that I sometimes forgot to put a "end" to my function which sometimes screwed up my workflow.

2. Look up how clean code should look like (preferably about löve/lua as you're working with it), it's good to have a good looking and clean code.
If you write a code so that you understand it that's fine but when you're maybe working in a group project or want someone else to understand it, it's very important that it's clean.

3. If you have encountered a problem with your project and wish to ask the forums (which is always welcome) add your code to your thread (see the code button), It will be easier for others to help you with your problem.

And like I said before make small projects and if you feel a little bit more confident in your abilities then look at a old classic game and redo it.

I have also added a link to books about lua and I suggest that you read the second version of it and If you don't want to buy the actual book of it I'm pretty sure that you can find other means of acquiring it .
http://www.lua.org/pil/
:awesome: Have a good day! :ultraglee:
User avatar
RonanZero
Citizen
Posts: 90
Joined: Mon Oct 20, 2014 3:33 am

Re: First little project and general questions about LOVE

Post by RonanZero »

nice wrote: Some of my learning with Löve
1. From what I learn from my experience with Löve is that always when you write a new function like a:

Code: Select all

function love.draw()
always put a end to it like this:

Code: Select all

function love.draw()
end
That was a bad habit that I had when I was learning that I sometimes forgot to put a "end" to my function which sometimes screwed up my workflow.
Well I just put an end the second after I make the function so I don't forget later, same for parentheses and anything that needs closing. (Unless I interpreted it wrong...?)
while true do end;
User avatar
nice
Party member
Posts: 191
Joined: Sun Sep 15, 2013 12:17 am
Location: Sweden

Re: First little project and general questions about LOVE

Post by nice »

RonanZero wrote: That was a bad habit that I had when I was learning that I sometimes forgot to put a "end" to
Well I just put an end the second after I make the function so I don't forget later, same for parentheses and anything that needs closing. (Unless I interpreted it wrong...?)
That's pretty much what I mean, Back in ye olden times, I had the habit of forgetting to add an "end" statement for my functions, thus my intention for a more "visual" explanation.
:awesome: Have a good day! :ultraglee:
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: First little project and general questions about LOVE

Post by Jasoco »

I use SublimeText which puts the End in automatically when I finish typing the closing parentheses and press return.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: First little project and general questions about LOVE

Post by Positive07 »

Jasoco wrote:I use SublimeText which puts the End in automatically when I finish typing the closing parentheses and press return.
I tried the same with Notepad++ but I'm so used to writing the end after the if and closing parentheses after opening them that I ended with two ends or two parentheses :x ... so I turned the option off hahaha
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 8 guests