Search found 227 matches
- Sat Feb 23, 2013 2:25 am
- Forum: Support and Development
- Topic: How would I create an idle state?
- Replies: 4
- Views: 2324
Re: How would I create an idle state?
In the update code you can simply do this: function love.update(dt) if (love.keyboard.isDown('left')) then face='left' x=x-speed*dt animLeft:update(dt) elseif (love.keyboard.isDown('right')) then face='right' x=x+speed*dt animRight:update(dt) else if face == 'left' then face = 'leftidle' else face ...
- Sat Feb 23, 2013 1:58 am
- Forum: Support and Development
- Topic: How would I create an idle state?
- Replies: 4
- Views: 2324
Re: How would I create an idle state?
Very easy to do. All you need is a variable for keeping track of which way you're facing. Personally, I'd keep animation state as a variable, too, and save yourself some code. Try this: require 'AnAL' ---- function love.load() love.graphics.setBackgroundColor(255,255,255) imgIdle1 = love.graphics.n...
- Sat Feb 23, 2013 1:09 am
- Forum: Support and Development
- Topic: How would I create an idle state?
- Replies: 4
- Views: 2324
How would I create an idle state?
The title might be a bit misleading, because I already know how to do an idle.. but it's a bit too long to explain in the title. First, I have two pictures. One, let's say, idle1.png, and the other, idle2.png. idle1.png would be facing right, for when player was walking right, and the other idle pic...
- Fri Feb 22, 2013 11:58 am
- Forum: Support and Development
- Topic: [SOLVED] Limiting a slider's movement?
- Replies: 2
- Views: 1352
Re: Limiting a slider's movement?
if (slide.x+slide.image:getWidth()/2 < 100) then slide.x=100 end if (slide.x+slide.image:getWidth()/2 > 400) then slide.x=400 end The if statements checks for the center of the slide, while the next line sets the left corner to 100. Try this: if (slide.x+slide.image:getWidth()/2 < 100) then slide.x...
- Fri Feb 22, 2013 12:02 am
- Forum: Support and Development
- Topic: [SOLVED] Limiting a slider's movement?
- Replies: 2
- Views: 1352
[SOLVED] Limiting a slider's movement?
I'm currently experimenting with some dragging in LOVE2D, I currently have a button sliding from one side to the other if I drag it. I want to be able to limit that movement. To do this, I tried checking if the X of the image was smaller that 100 (the X I want it to stop at) and if it was greater th...
- Sun Feb 17, 2013 9:24 pm
- Forum: Support and Development
- Topic: [SOLVED] Background Image? (I put if solved cause I'm nice)
- Replies: 4
- Views: 4763
Re: Background Image?
Hey, welcome to the forums!(Coming from someone who just registered to reply to you :p ) You don't need () in a "if then" condition. you can do "if a==b then" You're drawing the button, then the background. The button then can't be shown since it's under the background. The menu...
- Sun Feb 17, 2013 6:45 pm
- Forum: Support and Development
- Topic: [SOLVED] Background Image? (I put if solved cause I'm nice)
- Replies: 4
- Views: 4763
[SOLVED] Background Image? (I put if solved cause I'm nice)
Hey, I'm new to Love2d, and I'm making a game, currently. I know how to add a background image, it's possibly the simplest thing ever. The thing is, with a conditional statement (if() in this case), when I try to set a background image to a condition, it just displays a completely black screen. I've...