crossfire

Show off your games, demos and other (playable) creations.
User avatar
Beelz
Party member
Posts: 234
Joined: Thu Sep 24, 2015 1:05 pm
Location: New York, USA
Contact:

Re: crossfire

Post by Beelz »

CanadianGamer wrote:Thank you for your feedback if you could point me towards a good tutorial for the highscore idea it would be much appreciated
This is a snippet I snagged from... somewhere. Can't remember where, but here you go. Just call this function at the end of the round.

Code: Select all

function highScore(newScore)
	saveDir = love.filesystem.getSaveDirectory()
	saveFile = "highscore.txt"
	saveFileExists = love.filesystem.exists(saveFile)
	if saveFileExists then
		localHighScore = love.filesystem.read(saveFile)
		localHighScore = tonumber(localHighScore)
	else
		localHighScore = 0
	end

	if newScore > localHighScore then
		localHighScore = newScore
	end

	love.filesystem.write(saveFile, localHighScore)
	return localHighScore
end

Code: Select all

if self:hasBeer() then self:drink()
else self:getBeer() end
GitHub -- Website
User avatar
CanadianGamer
Party member
Posts: 132
Joined: Tue Jun 30, 2015 1:23 pm
Location: Canada
Contact:

Re: crossfire

Post by CanadianGamer »

ok now I've added both game music and game over music what do you think
My serious itch.io page:
https://pentamonium-studios.itch.io/
My less serious itch.io page:
http://canadiangamer.itch.io
User avatar
CanadianGamer
Party member
Posts: 132
Joined: Tue Jun 30, 2015 1:23 pm
Location: Canada
Contact:

Re: crossfire

Post by CanadianGamer »

Beelz wrote:
CanadianGamer wrote:Thank you for your feedback if you could point me towards a good tutorial for the highscore idea it would be much appreciated
This is a snippet I snagged from... somewhere. Can't remember where, but here you go. Just call this function at the end of the round.

Code: Select all

function highScore(newScore)
	saveDir = love.filesystem.getSaveDirectory()
	saveFile = "highscore.txt"
	saveFileExists = love.filesystem.exists(saveFile)
	if saveFileExists then
		localHighScore = love.filesystem.read(saveFile)
		localHighScore = tonumber(localHighScore)
	else
		localHighScore = 0
	end

	if newScore > localHighScore then
		localHighScore = newScore
	end

	love.filesystem.write(saveFile, localHighScore)
	return localHighScore
end

thank you
My serious itch.io page:
https://pentamonium-studios.itch.io/
My less serious itch.io page:
http://canadiangamer.itch.io
User avatar
CanadianGamer
Party member
Posts: 132
Joined: Tue Jun 30, 2015 1:23 pm
Location: Canada
Contact:

Re: crossfire

Post by CanadianGamer »

just released a version that has a highscore part in it i hope you enjoy
My serious itch.io page:
https://pentamonium-studios.itch.io/
My less serious itch.io page:
http://canadiangamer.itch.io
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests