Search found 8 matches

by Porkinator
Thu Jun 25, 2015 2:19 pm
Forum: Support and Development
Topic: Collision Function --- Nil?
Replies: 5
Views: 2709

Re: Collision Function --- Nil?

The if CheckCollision ... block should be inside the for-loop just before it. That's where enemy is defined, that's where you want to check for collisions. Thank you! That seems to have fixed the problem. I knew I was doing something obvious wrong... Anyways, here's the finished result. It's a less...
by Porkinator
Tue Jun 23, 2015 3:21 pm
Forum: Support and Development
Topic: Collision Function --- Nil?
Replies: 5
Views: 2709

Re: Collision Function --- Nil?

Error: main.lua:70: attempt to index global 'enemy' (a nil value) stack traceback: main.lua:70: in function 'update' [string "boot.lua"]:442: in function <[string "boot.lua"]:413> [C]: in function 'xpcall' This is what it gives me when I change it to the 'enemy' variable. Someho...
by Porkinator
Tue Jun 23, 2015 3:04 pm
Forum: Support and Development
Topic: Collision Function --- Nil?
Replies: 5
Views: 2709

Re: Collision Function --- Nil?

if CheckCollision(enemies.x, enemies.y, enemyImg:getWidth(), enemyImg:getHeight(), player.p_x, player.p_y, player.w, player.h) and isAlive then table.remove(enemies, i) isAlive = false; end So what is enemies.x supposed to be? Um, it wouldn't accept enemy.x as a parameter, so I put enemies.x, is th...
by Porkinator
Mon Jun 22, 2015 2:05 pm
Forum: Support and Development
Topic: Collision Function --- Nil?
Replies: 5
Views: 2709

Collision Function --- Nil?

Hello, and good day. I have come here regarding a serious problem within my game. Everything was going smoothly, but when I finished my collision function, I opened the game, and it gave me THIS nonsense... :x Error: main.lua:103: attempt to compare nil with number stack traceback: main.lua:103: in ...
by Porkinator
Fri Mar 27, 2015 1:23 pm
Forum: General
Topic: HEELP!
Replies: 5
Views: 2203

Re: HEELP!

Ok, but it's still giving me the comparing number with nil error. Any thoughts on that?
by Porkinator
Thu Mar 26, 2015 5:01 pm
Forum: General
Topic: HEELP!
Replies: 5
Views: 2203

HEELP!

Help! I'm trying to make a humble little game and lua is acting strange! I have not one but TWO problems! Firstly, in my CheckCollision function, it keeps telling me that I am comparing a number with nil. What?? I see nothing with a nil value here. function CheckCollision(x1, y1, w1, h1, x2, y2, w2,...
by Porkinator
Wed Mar 25, 2015 1:35 pm
Forum: General
Topic: SOS! Dt issues!
Replies: 3
Views: 2129

Re: SOS! Dt issues!

Hi and welcome to the forum. You need to replace the function declaration of the love.update by this: function love.update(dt) Otherwise the variable dt is not define inside this function. By the way: You can make your code much more readable by putting it into code-tags (mark your code and press t...
by Porkinator
Wed Mar 25, 2015 1:04 pm
Forum: General
Topic: SOS! Dt issues!
Replies: 3
Views: 2129

SOS! Dt issues!

Help! I'm trying to do a tutorial, but whenever I try to move my 'player', I always get the same error message - 'main.lua:9: attempt to perform arithmetic on global 'dt' (a nil value)' What does this mean and how can I fix it? Here is my code -- function love.load() player = { x = 200, y = 710, spe...