My ongoing newbie questions

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: My ongoing newbie questions

Post by Robin »

You still forgot my first comment: x ~= n :P
Help us help you: attach a .love.
essell
Prole
Posts: 15
Joined: Tue Jun 09, 2009 6:26 pm
Location: Newcastle, UK
Contact:

Re: My ongoing newbie questions

Post 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?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: My ongoing newbie questions

Post 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.
Help us help you: attach a .love.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: My ongoing newbie questions

Post 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
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: My ongoing newbie questions

Post 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().
Help us help you: attach a .love.
essell
Prole
Posts: 15
Joined: Tue Jun 09, 2009 6:26 pm
Location: Newcastle, UK
Contact:

Re: My ongoing newbie questions

Post 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?
User avatar
osgeld
Party member
Posts: 303
Joined: Sun Nov 23, 2008 10:13 pm

Re: My ongoing newbie questions

Post 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()
essell
Prole
Posts: 15
Joined: Tue Jun 09, 2009 6:26 pm
Location: Newcastle, UK
Contact:

Re: My ongoing newbie questions

Post 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?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: My ongoing newbie questions

Post by bartbes »

It's known there are some issues with applyImpulse and applyForce, so an alternative is setVelocity (on the body).
essell
Prole
Posts: 15
Joined: Tue Jun 09, 2009 6:26 pm
Location: Newcastle, UK
Contact:

Re: My ongoing newbie questions

Post 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?
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests