Well, it's your decision reading the tutorials or not; not really our jobs to hand-hold.
Edit: wow, i was ninja'd by a whole page... fml.
Game with separate files tryout
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Game with separate files tryout
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Game with separate files tryout
Thanks.
Code: Select all
10 if love.keyboard.isDown("right") then
11 10 + 40 * dt
12 end
How should LÖVE/Lua know what these calculations are for? As result, lua throws an error telling you that there has to be something wrong with your code on line 11 and stops searching for more errors.
Your previous code was fine, and I uploaded a working example showing how the code could look like. So why don't you start with the working example and experiment with it until you understand how the syntax has to look like.
Another problem I've seen is that you tried using colon syntax and self and mixed this with the dot syntax...
Code: Select all
function square:setup()
self.img = love.graphics.newImage('player.png')
self.x = 100
self.y = 100
end
As a starting point I would suggest reading a bit more about variables, operators and tables and how they work. The lua pil is a good source where you'll find answers for almost everything lua related.
Edit - Zorg is right, we won't hand-hold you through every error you get, so please take our advises and try learning the lua language to some extend. It might be hard when you are new and we are willing to help, but most of the errors you got can be solved with just reading and researching what the error handler displays.
-
- Prole
- Posts: 17
- Joined: Thu Nov 23, 2017 4:46 pm
Re: Game with separate files tryout
I tested it by myself and now it works! Thank you so much!MadByte wrote: ↑Fri Dec 15, 2017 8:21 pmThanks.
So you changed all variables to static numbers and also didn't tell lua how it should use the results of your calculations.Code: Select all
10 if love.keyboard.isDown("right") then 11 10 + 40 * dt 12 end
How should LÖVE/Lua know what these calculations are for? As result, lua throws an error telling you that there has to be something wrong with your code on line 11 and stops searching for more errors.
Your previous code was fine, and I uploaded a working example showing how the code could look like. So why don't you start with the working example and experiment with it until you understand how the syntax has to look like.
Another problem I've seen is that you tried using colon syntax and self and mixed this with the dot syntax...Generally this will be the way to go later, but for now you should avoid using self and the colon syntax and stick with the dot.Code: Select all
function square:setup() self.img = love.graphics.newImage('player.png') self.x = 100 self.y = 100 end
As a starting point I would suggest reading a bit more about variables, operators and tables and how they work. The lua pil is a good source where you'll find answers for almost everything lua related.
Edit - Zorg is right, we won't hand-hold you through every error you get, so please take our advises and try learning the lua language to some extend. It might be hard when you are new and we are willing to help, but most of the errors you got can be solved with just reading and researching what the error handler displays.
Also, I'm so sorry about my temper and my impatience about before. I remember I should've add another function to put the variables there. Mistake of mine. I don't know why my head forgets important stuff.
Who is online
Users browsing this forum: Ahrefs [Bot] and 7 guests