Search found 43 matches

by IMP1
Wed Mar 07, 2012 11:10 am
Forum: Support and Development
Topic: Declare a key press combination for love.keyboard.isDown?
Replies: 15
Views: 6718

Re: Declare a key press combination for love.keyboard.isDown

vrld wrote:Immediate mode is superior again:

Code: Select all

function love.keyboard.allDown(k, ...)
    if not k then return true end
    return love.keyboard.isDown(k) and love.keyboard.allDown(...)
end
Should that not be return false?

Either way I love this method.
by IMP1
Mon Mar 05, 2012 11:20 am
Forum: Support and Development
Topic: Declare a key press combination for love.keyboard.isDown?
Replies: 15
Views: 6718

Re: Declare a key press combination for love.keyboard.isDown

Code: Select all

if love.keyboard.isDown("lctrl") and love.keyboard.isDown("d") then
    -- speed = 100 or whatever
end
by IMP1
Mon Jan 16, 2012 9:48 pm
Forum: Support and Development
Topic: A loop within a loop
Replies: 7
Views: 2422

Re: A loop within a loop

In what format is the map? I ask because when I have my maps, they're in the form { { 1, 1, 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1, 1, 1 }, } In which case the loop needs to be y and then x. And doing it the other way round (unless the map is square) will result in error (and even...
by IMP1
Wed Jan 11, 2012 6:12 pm
Forum: Support and Development
Topic: Mouse: How to emulate "MouseLook" from FPS games?
Replies: 24
Views: 4885

Re: Mouse: How to emulate "MouseLook" from FPS games?

It's not perfect in terms of the angle. It should be slightly less, but the maths is a lot more confusing. local angle = math.atan( (dx * TURN_SPEED) / VISION_LENGTH ) should be local y = math.sqrt(math.abs(VISION_LENGTH ^ 2 - dx ^ 2)) local angle = math.atan( (dx * TURN_SPEED) / y ) Not sure about ...
by IMP1
Wed Jan 11, 2012 12:56 pm
Forum: Support and Development
Topic: Mouse: How to emulate "MouseLook" from FPS games?
Replies: 24
Views: 4885

Re: Mouse: How to emulate "MouseLook" from FPS games?

This kinda works for me: function love.load() TURN_SPEED = 0.005 VISION_LENGTH = 1 inverseYAxis = true horizontalAngle = 0 verticalAngle = 0 love.mouse.setGrab(true) love.mouse.setVisible(false) love.mouse.setPosition( love.graphics.getWidth() / 2, love.graphics.getHeight() / 2 ) oldMouse = { love.m...
by IMP1
Sun Jan 08, 2012 2:58 am
Forum: Support and Development
Topic: My rubbishy cache thingy. Any point?
Replies: 7
Views: 2052

My rubbishy cache thingy. Any point?

Now, I'm the first to admit that I'm not the oldest cow in the field, and so I'm always wondering whether what I think is a new and genius idea is actually doing any good. So I thought I'd ask whether this here code: local aliasNewImage = love.graphics.newImage local imageCache = {} function love.gr...
by IMP1
Fri Dec 30, 2011 2:31 pm
Forum: Support and Development
Topic: How do you change backgrounds when a key is pressed?
Replies: 2
Views: 1697

Re: How do you change backgrounds when a key is pressed?

You shouldn't really have a love.graphics.draw in the love.keypressed method. Or anywhere outside of love.draw at all. this is how I'd go about what you seem to be trying to do: function love.load() love.graphics.setCaption("Seal Off") -- Create a table which we will fill with background i...
by IMP1
Thu Dec 29, 2011 9:31 pm
Forum: Support and Development
Topic: Pausing.
Replies: 6
Views: 2364

Re: Pausing.

And for when you lose focus:

Code: Select all

function love.focus(f)
  if not f and not paused then
    pause = true
  end
end
by IMP1
Tue Dec 27, 2011 11:33 pm
Forum: Support and Development
Topic: interacting with txt files?
Replies: 3
Views: 1335

Re: interacting with txt files?

love.filesystem seems to be what you're looking for. Particularly http://love2d.org/wiki/love.filesystem.read ?
by IMP1
Wed Dec 14, 2011 5:04 pm
Forum: Games and Creations
Topic: Simple mouse game
Replies: 17
Views: 6832

Re: Simple mouse game

Why not link straight to the file?

http://www.speedyshare.com/file/V3Ss9/d ... pGame.Love

Like that ^

All the usefulness of obnoxious uploadery sites without any of the cons.