Rush (Assets)

Retourner au jeu

Vous pouvez utiliser ces fichiers mais pensez à me créditer :p

La cartouche
Les sprites

Code


--rush (1hgj)
--by bigaston

poke(0x5f2d, 1) -- initiate mouse listener
btime=0

function _init()
	mouse={}
	mouse.x=0
	mouse.y=0
	mouse.press=0
	game_over=false
	finish=false
	
	carte={}
	carte.x=0
	carte.y=0
	level=0
end

function _update()
	test()
	mouse.x=stat(32)
	mouse.y=stat(33)
	mouse.press=stat(34)
	
	if (level==8) then
		if not (finish) then
			finish=true
			ftime=time()-btime
		end
	end
	
	if (game_over) or (finish) then
		if (btnp(5)) then
			btime=time()
			_init()
		end
	end
end

function _draw()
	cls()
	rectfill(0,0,128,6,5)
	
	if not (finish) and not (game_over) then
		print("⧗time:"..time()-btime,84,1,6)
		print("◆level:"..level,1,1,6)
	end
	
	if not (game_over) then
		map(carte.x,carte.y,32,32,8,8)
		spr(1,mouse.x,mouse.y)
	end
	
	if (game_over) then
		print("you loose!",44,20,6)
		print("your level is "..level,35,26,6)
		print("press ❎ to restart",28,32,6)
	end
	
	if (finish) then
		print("gg! you finish the game!",17,20,6)
		print("your time is "..ftime,26,26,6)
		print("press ❎ to restart",28,32,6)
	end
end

function test()
	if (pget(mouse.x,mouse.y)==8) then
		game_over=true
		sfx(1)
	end
	
	if (pget(mouse.x,mouse.y)==11) then
		level+=1
		carte.x+=8
		sfx(0)
	end	
end