Skip to content
Discussion options

You must be logged in to vote

I found out a solution that seems to be the best / most logical for me:
The built-in BOOT-function seems to be called as the first function but after TIC-80 has "had a look at" the rest of the code.
Thus putting gamestate=title inside BOOT also works and I can happily put the function "title" wherever I want.
My solution:

function BOOT()
	gamestate=title
end

function TIC()
	gamestate()
end

function init_play()
	gamestate=play
end


function init_title()
	gamestate=title
end

function title()
	cls(2)
	print("title gamestate",10,10,12)
	if btnp(4) then
		init_play()
	end
end

function play()
	cls(6)
	print("play gamestate",10,10,12)
	if btnp(4) then
		init_title()
	end
end

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@Anrock
Comment options

Anrock Jan 7, 2023
Collaborator

@nikgid
Comment options

Comment options

You must be logged in to vote
1 reply
@nikgid
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by nikgid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants