Search found 12 matches

by Maholain
Mon Sep 27, 2010 5:07 pm
Forum: Support and Development
Topic: Using getPixel and setPixel
Replies: 9
Views: 3067

Re: Using getPixel and setPixel

Convert it into an image, draw that image. Neat! Thanks, problem solved. The code I used if anyone is interested: --This code will reveal what's behind it because of setPixel being set to invisible function love.update(dt) if love.mouse.isDown("l") then local r, g, b = coverData:getPixel(...
by Maholain
Mon Sep 27, 2010 4:52 pm
Forum: Support and Development
Topic: Using getPixel and setPixel
Replies: 9
Views: 3067

Re: Using getPixel and setPixel

Thanks. I still can't get my initial idea to work though. I think it's because

Code: Select all

coverData:setPixel(love.mouse.getX(), love.mouse.getY(), 40, 40, 40, 255);
is only setting the pixel on coverData. I can't draw a ImageData though, so how can I show this coverData on the screen?
by Maholain
Mon Sep 27, 2010 4:20 pm
Forum: Support and Development
Topic: Using getPixel and setPixel
Replies: 9
Views: 3067

Re: Using getPixel and setPixel

I'm trying to set the pixel below the cursor to say green if the pixel below my cursor is black. --In load coverData = love.image.newImageData("overlay.png"); --in Update if love.mouse.isDown("l") then local r, g, b, a = coverData:getPixel(love.mouse.getX(), love.mouse.getY()); i...
by Maholain
Sun Sep 26, 2010 11:37 pm
Forum: Support and Development
Topic: Using getPixel and setPixel
Replies: 9
Views: 3067

Using getPixel and setPixel

I was looking at the getPixel API and saw it's synopsis as this: r, g, b, a = ImageData:getPixel( x, y ) I was wondering, how would I compare what it returns in an if statement? I'm not sure what to do when it returns more than one thing. Also, when I used setPixel in the update method, I got a 'att...
by Maholain
Wed Jun 24, 2009 8:09 pm
Forum: General
Topic: Collision detection in Löve?
Replies: 14
Views: 7349

Re: Collision detection in Löve?

Robin wrote:using a keyreleased callback, and setVelocity(0,0)?
Wow, I'm dumb :o Thanks for the help everyone!
by Maholain
Tue Jun 23, 2009 9:38 pm
Forum: General
Topic: Collision detection in Löve?
Replies: 14
Views: 7349

Re: Collision detection in Löve?

Okay, so do I put the set Velocity in a keypress callback to make something move?

EDIT:So I got the above working. However... how do I stop the velocity after I release the key?
by Maholain
Tue Jun 23, 2009 7:50 pm
Forum: General
Topic: Collision detection in Löve?
Replies: 14
Views: 7349

Re: Collision detection in Löve?

Sardtok wrote:Have a look at the Body documentation posted above.
There are getters and setters for other physical attributes like velocity which might come in handy.
I'm guessing you're talking about love.physics.body_setVelocity? And what exactly would I use get for? Set I understand...
by Maholain
Tue Jun 23, 2009 6:13 pm
Forum: General
Topic: Collision detection in Löve?
Replies: 14
Views: 7349

Re: Collision detection in Löve?

Okay, but since setX and getX isn't used for moving objects, how could I get a way to move objects in my code example (look above a few posts)? Kinda confused here. Basically, if someone could upload an example with working movement, I'd be very happy and learn loads off of it! :ultrahappy:
by Maholain
Tue Jun 23, 2009 5:13 pm
Forum: General
Topic: Collision detection in Löve?
Replies: 14
Views: 7349

Re: Collision detection in Löve?

My error was main.lua:34: attempt to perform arithmetic on global 'x' (a nil value). I have attached the file below: if love.keyboard.isDown(love.key_right) then x = x + (speed * dt) elseif love.keyboard.isDown(love.key_left) then x = x - (speed * dt) end Setting x doesn't really work if you have n...
by Maholain
Tue Jun 23, 2009 5:02 pm
Forum: General
Topic: Collision detection in Löve?
Replies: 14
Views: 7349

Re: Collision detection in Löve?

My error was main.lua:34: attempt to perform arithmetic on global 'x' (a nil value). I have attached the file below:


Anyways, since I don't really like using Box2d, are there any examples of programming a collision detection without using love.physics?

Thank you.