Page 1 of 1

[ANSWERED] Question about My Method of Animation and Quads

Posted: Sat May 23, 2020 1:23 am
by sphyrth
I know that this will end with "whatever I prefer", but I like to know your opinion on this.

So, I have 2 main approaches of handing animation:

#1 - The traditional-Tutorial Way (Setting Up Several Quads to be accessed for every framerate tick)

Code: Select all

function love.load()
  quads = {
    quad1, quad2, ..., quadN
  }
end
#2 - Using only 1 Quad and resetting its viewport for every framerate tick.

Code: Select all

function love.update()
  ... -- Frame-rate is Assumed
  quad:setViewport(frame_x + (frame_no * frame_size), frame_y, frame_size, frame_size, img_w, img_h)
  ...
end
I know there's the more convenient way of Using an already-existing Library, but Love2D is a Framework for a reason. So that's not an option for me.

If you guys were to choose for me, which method would you prefer and why?

Re: Question about My Method of Animation and Quads

Posted: Sat May 23, 2020 2:27 am
by 4vZEROv
First way, I don't like to call functions more than I need.

Re: Question about My Method of Animation and Quads

Posted: Sat May 23, 2020 11:05 am
by pgimeno
In general I'd prefer method 1. Only if you have serious memory problems because you have lots and lots of animations (hence lots and lots of quads) in a very restricted system, then you can trade speed for memory and go with approach 2.

I doubt memory would ever be a problem that can be solved that way, though.