I understand that there was a recent update, but I can only find the 'getting started' page of the older v. Where's latest version of LOVE's getting started page? Thanks in advance
Edit: Also, how does one start a timer since the app has been launched? (Something that tells you how long you were playing)
Where can I find a newb friendly layout on getting started?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Where can I find a newb friendly layout on getting started?
simply look in the doc for the timer, and for the recent things idk.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Where can I find a newb friendly layout on getting started?
http://love2d.org/docs/getting_started.html is the getting started page.
Help us help you: attach a .love.
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: Where can I find a newb friendly layout on getting started?
untested:Xoria wrote:Edit: Also, how does one start a timer since the app has been launched? (Something that tells you how long you were playing)
Code: Select all
function love.load()
time=0
end
function love.update(dt)
time = time+dt
end
function love.draw()
love.graphics.print(math.floor(time).." seconds have passed",0,12) --math.floor(x) truncates the decimal off x
end
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Where can I find a newb friendly layout on getting started?
I offer an alternative method.
At least this method works in 0.5.0. As long as 0.6.0 still uses getTime() to return the seconds since application launch.
And a bonus, a function that converts seconds into hours, minutes and seconds that I wrote myself:
I used this method for my game engine to calculate how much total time you spent in a single game session between saves. You know like how RPG's will display total play time.
Use this when setting up the game variables:
Then use this when you load a game right after loading the game, or set it to 0 if starting a new one: (Usually right in the same function)
Use this every update during the actual game play:
When saving the game, save the gameSession variable for loading next time.
Code: Select all
function love.load()
stime = love.timer.getTime()
end
function love.update(dt)
time = stime - love.timer.getTime()
end
function love.draw()
love.graphics.print(math.floor(time).." seconds have passed",0,12)
end
And a bonus, a function that converts seconds into hours, minutes and seconds that I wrote myself:
Code: Select all
function formatTime(t) return math.floor(math.mod(t/60/60,60)) .. ":" .. string.sub("0" .. math.floor(math.mod(t/60,60)),-2) .. ":" .. string.sub("0" .. math.floor(math.mod(t,60)),-2) end
Use this when setting up the game variables:
Code: Select all
gameStartTime = love.timer.getTime()
Code: Select all
gameSessionPrevious = gameSession
Code: Select all
gameSession = love.timer.getTime() - gameStartTime
Who is online
Users browsing this forum: Ahrefs [Bot] and 11 guests