Page 3 of 5

Re: My ongoing newbie questions

Posted: Fri Jun 12, 2009 5:48 am
by Robin
You still forgot my first comment: x ~= n :P

Re: My ongoing newbie questions

Posted: Fri Jun 12, 2009 11:56 am
by essell
Q. What does "No matching function for overloaded 'draw'" mean, when I try and run my game and there's a showstopping error?

Re: My ongoing newbie questions

Posted: Fri Jun 12, 2009 12:12 pm
by Robin
That one is a classic. You'll get that a lot. It means the wrong type is fed into the love.grahics.draw() function. You can check the type of the first argument by printing it. You probably made a typo, or forgot to index a table, or something like that.

Re: My ongoing newbie questions

Posted: Fri Jun 12, 2009 4:22 pm
by bartbes
Be warned, that is the most frequently found cause of that error, but it might mean more. It could be:
  • One of your arguments is not what it expects (userdata or string as 1st argument), could be nil
  • There are too much arguments
  • There are not enough arguments (I sometimes forget to pass coordinates when I want to debug something)
  • An earlier call failed, so you're passing a nil value without knowing it
  • Probably others

Re: My ongoing newbie questions

Posted: Fri Jun 12, 2009 5:04 pm
by Robin
@bartbes: you are completely right.

@essell: what we're trying to say here is: to fix this, you have to make sure you are passing the right arguments. To see what they are, try print()ing them before the love.graphics.draw().

Re: My ongoing newbie questions

Posted: Sun Jun 14, 2009 3:27 pm
by essell
Righto - I'll try it the next time it comes up.

Q. I'm trying to implement some really basic kind of collision detection (bullets hitting the player / enemies). What's the simplest / suggested way of doing this?

Re: My ongoing newbie questions

Posted: Sun Jun 14, 2009 9:57 pm
by osgeld
some what easy and accurate would be to use loves physics system

super easy but very inaccurate would be to just have imaginary boxes defined around an object and check xy pos's, if the bullet is in the box, hit

ie:

if bullet x,x is inside of head x,y then splatter_brains()

Re: My ongoing newbie questions

Posted: Sun Jun 14, 2009 10:19 pm
by essell
Okeydokey - I'm having a go at implementing the physics stuff.

[Edit] Done! But now my previous means of moving the player character...

Code: Select all

	if love.keyboard.isDown(love.key_right) then
			playerx = playerx + movespeed * dt
	end
...Doesn't work anymore.

Q. Is this because the player is now a physics object, meaning I have to manipulate it's position differently? If so, how?

Re: My ongoing newbie questions

Posted: Mon Jun 15, 2009 5:26 am
by bartbes
It's known there are some issues with applyImpulse and applyForce, so an alternative is setVelocity (on the body).

Re: My ongoing newbie questions

Posted: Tue Jun 16, 2009 11:48 am
by essell
Am having trouble figuring this out (player movement with physics).

Q. Can anyone suggest a Love game to refer to as a simple example of pressing arrow keys to move an avatar around in a basic physics-enabled world?