Could really use some help in Lua, have hit a wall and can't move forward.

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
Paz
Prole
Posts: 11
Joined: Sat Jun 09, 2018 12:13 pm

Re: Could really use some help in Lua, have hit a wall and can't move forward.

Post by Paz »

DarkShroom wrote: Mon Jun 18, 2018 11:31 pm i agree with you, well done, i have rarely agreed with some of these libraries myself, although i am not sure it might have been the case i should've used one of the camera ones as i am sort of rendering everything offscreen at the moment

i have no problem with animation in my framework, i simply string an array of images to cycle through, and have a separate optional frame duration array

i understand you're going for a tileset solution though... i don't want this yet as i consider myself to be prototyping... i feel if i do use tilesets, i will build these in lua itself from my separate frame assets (i don't like working with tile-sets, it makes me feel like i'm on a megadrive)

this answer may not help you, but sometimes it is best to get a prototype solution working first (although this may depend on your assets)


however, that said as it may be a required future optimisation i might make a point of tackling this tomorrow, assuming i finish my terrain deformation strategy and other pending task

in the meantime, have you read this yet, i don't remember it being at all complicated:

https://love2d.org/wiki/Tutorial:Effici ... _Scrolling

i see no "quads" in your code... good luck
I was under the impression that "quads" were predominately used coinciding with sprite sheets? There has to be a way to accomplish that same task of animation without sprite sheets and quads right?
DarkShroom
Citizen
Posts: 86
Joined: Mon Jul 17, 2017 2:07 pm

Re: Could really use some help in Lua, have hit a wall and can't move forward.

Post by DarkShroom »

yes they are

i thought you where using spritesheets?

well yeah without them, just cycle through the pictures with a timer, have the pictures in like a table of pictures
KayleMaster
Party member
Posts: 234
Joined: Mon Aug 29, 2016 8:51 am

Re: Could really use some help in Lua, have hit a wall and can't move forward.

Post by KayleMaster »

Paz wrote: Tue Jun 19, 2018 2:05 am I was under the impression that "quads" were predominately used coinciding with sprite sheets?
And sprite sheets are predominately used with animations :awesome:
DarkShroom
Citizen
Posts: 86
Joined: Mon Jul 17, 2017 2:07 pm

Re: Could really use some help in Lua, have hit a wall and can't move forward.

Post by DarkShroom »

hehe... nah everyone trying to be helpful but i feel there's some confusion going on

so myself, i DON'T use spritesheets (yet), i just cycle through the pictures i have in a table (using a timer and a frame duration), i think i gather from your replies you just don't believe it's the right way or something

you don't have to use the quads, and it sounds like you're not bothered about that yet
DarkShroom
Citizen
Posts: 86
Joined: Mon Jul 17, 2017 2:07 pm

Re: Could really use some help in Lua, have hit a wall and can't move forward.

Post by DarkShroom »

i feel you'll have an easier time if you can articulate your questions more clearly

the subject title says nothing about animation, and we where all unclear on the question


intended as constructive criticism, but i understand it's difficult sometimes
KayleMaster
Party member
Posts: 234
Joined: Mon Aug 29, 2016 8:51 am

Re: Could really use some help in Lua, have hit a wall and can't move forward.

Post by KayleMaster »

Maybe try this paz:

Code: Select all

function love.update(dt)
  local elapsedTime = 0
  elapsedTime = elapsedTime + dt --one down if elapsedTime > 0.5 every .5 seconds the loop runs and is reset at the end.
  if (love.keyboard.isDown("d")) then 
    currentFrame = 2
    for index,frame in ipairs(para) do 
    	frame.x = frame.x + 200 * dt 
    	if frame.x > love.graphics.getWidth() + frame.image:getWidth() then frame.x = 0 end
    end
  else
    currentFrame = 1 
  end
  elapsedTime = 0
end
You're kinda doing it wrong. You shouldn't store the x,y for each frame. This table setup isn't an animation, but more like different entities. Why would animations have different x,y ? It should be x,y offsets not general position on the screen. You need to rethink that. With your original code, your expected result, if it worked, would be:
kirby running from left-to-right but when you let go of the button, kirby standing is in the middle of the screen, since we were just changing kirby running' animation.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest