French Cooker (Assets)

Retourner au jeu

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

La cartouche
Les sprites

Code


--french coocker (1hgj)
--by bigaston

poke(0x5f2d,1) -- initiate mouse listener
cartdata("bigaston_french")

function _init()
	mouse={}
	mouse.x=0
	mouse.y=0
	mouse.press=0
	
	frog={}
	frog.x1=0
	frog.y1=0
	frog.x2=frog.x1+8
	frog.y2=frog.y1+6
	frog.grab=false
	
	random_frog()
	score=dget(0)
end

function restart()
	dset(0,0)
	_init()
end

menuitem(1,"restart",restart)

function _update()	
	mouse.x=stat(32)
	mouse.y=stat(33)
	mouse.press=stat(34)
	
	test_frog()
	update_frog()
	cocotte()
end

function _draw()
	cls()
	
	rectfill(44,1,87,10,0)
	print("★score:"..score,47,4,5)
	print("★score:"..score,46,3,7)
	rect(44,1,87,10,7)
	
	rectfill(0,121,128,128,5)
	print("create in 1h for the 145th 1hgj",3,122,7)
	sspr(16,0,16,7,35,50,64,28)
	
	spr(4,frog.x1,frog.y1)
	spr(1,mouse.x,mouse.y)
end

function test_frog()
	if (mouse.press==1) then
		if ((mouse.x>=frog.x1) and (mouse.x<=frog.x2)) then
			if ((mouse.y>=frog.y1) and (mouse.y<=frog.y2)) then
				frog.grab=true
			end
		end
	end
	
	if ((mouse.press==2) and (frog.grab)) then
		frog.grab=false
	end
end

function update_frog()
	if (frog.grab) then
		frog.x1=mouse.x-4
		frog.x2=frog.x1+8
		frog.y1=mouse.y-3
		frog.y2=frog.y1+6
	end
end

function random_frog()
	frog.x1=flr(rnd(120))
	frog.x2=frog.x1+8
	
	frog.y1=flr(rnd(40))+80
	frog.y2=frog.y1+6
end

function cocotte()
	if (frog.grab==false) then
		if ((frog.x1>=47) and (frog.x1<=79)) then
			if ((frog.y1>=54) and (frog.y1<=68)) then
				score+=1
				random_frog()
				sfx(0)
				dset(0,score)
			end
		end
	end
end