[ANSWERED] Question about My Method of Animation and Quads

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.
Post Reply
sphyrth
Party member
Posts: 140
Joined: Mon Jul 07, 2014 11:04 am
Contact:

[ANSWERED] Question about My Method of Animation and Quads

Post by sphyrth » Sat May 23, 2020 1:23 am

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?
Last edited by sphyrth on Sun May 24, 2020 2:02 am, edited 1 time in total.

User avatar
4vZEROv
Citizen
Posts: 87
Joined: Wed Jan 02, 2019 8:44 pm

Re: Question about My Method of Animation and Quads

Post by 4vZEROv » Sat May 23, 2020 2:27 am

First way, I don't like to call functions more than I need.

User avatar
pgimeno
Party member
Posts: 2133
Joined: Sun Oct 18, 2015 2:58 pm

Re: Question about My Method of Animation and Quads

Post by pgimeno » Sat May 23, 2020 11:05 am

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests