Added tutorial
This commit is contained in:
parent
b4ea49bee8
commit
802ec50485
Binary file not shown.
After Width: | Height: | Size: 9.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 785 B |
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
1
game.lua
1
game.lua
|
@ -12,6 +12,7 @@ function Game:reinit()
|
||||||
self.objects.ending = require "objects/end"
|
self.objects.ending = require "objects/end"
|
||||||
self.objects.background = require "objects/background"
|
self.objects.background = require "objects/background"
|
||||||
self.objects.transition= require "objects/transition"
|
self.objects.transition= require "objects/transition"
|
||||||
|
self.objects.tutorial = require "objects/tutorial"
|
||||||
self.rect = require "lib/rect"
|
self.rect = require "lib/rect"
|
||||||
self.maxobjects = 0
|
self.maxobjects = 0
|
||||||
self.camerax = 0
|
self.camerax = 0
|
||||||
|
|
|
@ -18,12 +18,12 @@ function gen:new(game,x,y,color,grid)
|
||||||
Circle.highlightTimer = game:Timer(0.08)
|
Circle.highlightTimer = game:Timer(0.08)
|
||||||
|
|
||||||
function Circle:step(dt)
|
function Circle:step(dt)
|
||||||
self.drawx = self.drawx + (self.rect.x-self.drawx)/10
|
self.drawx = self.drawx + (self.rect.x-self.drawx)*dt*5
|
||||||
self.drawy = self.drawy + (self.rect.y-self.drawy)/10
|
self.drawy = self.drawy + (self.rect.y-self.drawy)*dt*5
|
||||||
local i = 1
|
local i = 1
|
||||||
for i=1,#self.moves do
|
for i=1,#self.moves do
|
||||||
self.shadowpos[i][1]= self.shadowpos[i][1] + (self.moves[i][1]-self.shadowpos[i][1])/10
|
self.shadowpos[i][1]= self.shadowpos[i][1] + (self.moves[i][1]-self.shadowpos[i][1])*dt*5
|
||||||
self.shadowpos[i][2]= self.shadowpos[i][2] + (self.moves[i][2]-self.shadowpos[i][2])/10
|
self.shadowpos[i][2]= self.shadowpos[i][2] + (self.moves[i][2]-self.shadowpos[i][2])*dt*5
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.highlight then
|
if self.highlight then
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
local gen = {}
|
||||||
|
|
||||||
|
function gen:new(game,x,y)
|
||||||
|
|
||||||
|
local sprite = game:newImage("question.png")
|
||||||
|
local w = sprite:getWidth()
|
||||||
|
local h = sprite:getHeight()
|
||||||
|
local tut = game.objects.base:new(game,x-w/2,y-h/2,w,h)
|
||||||
|
|
||||||
|
tut.questionsprite = sprite
|
||||||
|
tut.closesprite = game:newImage("close.png")
|
||||||
|
tut.tutorialsprite = game:newImage("tutorial.png")
|
||||||
|
tut.sprite = sprite
|
||||||
|
tut.showing = false
|
||||||
|
tut.basedrawy = game.HEIGHT
|
||||||
|
tut.objectivedrawy = (game.HEIGHT-tut.tutorialsprite:getHeight())/2
|
||||||
|
tut.drawy = tut.basedrawy
|
||||||
|
|
||||||
|
tut.depth = 3
|
||||||
|
|
||||||
|
function tut:step(dt)
|
||||||
|
local obj = self.basedrawy
|
||||||
|
self.sprite = self.questionsprite
|
||||||
|
if self.showing then
|
||||||
|
self.sprite = self.closesprite
|
||||||
|
obj = self.objectivedrawy
|
||||||
|
end
|
||||||
|
self.drawy = self.drawy + (obj-self.drawy)*dt*5
|
||||||
|
end
|
||||||
|
|
||||||
|
function tut:MouseCallback(x,y,presses)
|
||||||
|
if self.rect:collidepoint(x,y) then self.showing = not self.showing end
|
||||||
|
end
|
||||||
|
|
||||||
|
function tut:draw()
|
||||||
|
local s = self.tutorialsprite
|
||||||
|
lg.draw(s,(self.game.WIDTH-s:getWidth())/2,self.drawy)
|
||||||
|
lg.draw(self.sprite,self.rect.x-self.game.camerax,self.rect.y-self.game.cameray)
|
||||||
|
end
|
||||||
|
|
||||||
|
return tut
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return gen
|
|
@ -7,6 +7,8 @@ function scenes:main(game)
|
||||||
local y = (game.HEIGHT-cellsize*5)/2
|
local y = (game.HEIGHT-cellsize*5)/2
|
||||||
local grid = game.objects.grid:new(game,x,y,cellsize)
|
local grid = game.objects.grid:new(game,x,y,cellsize)
|
||||||
game:summon(grid)
|
game:summon(grid)
|
||||||
|
local tut = game.objects.tutorial:new(game,game.WIDTH-25,25)
|
||||||
|
game:summon(tut)
|
||||||
local background = game.objects.background:new(game,game:newImage("pattern.png"),30,15)
|
local background = game.objects.background:new(game,game:newImage("pattern.png"),30,15)
|
||||||
game:summon(background)
|
game:summon(background)
|
||||||
local background = game.objects.background:new(game,game:newImage("pattern2.png"),30,-15)
|
local background = game.objects.background:new(game,game:newImage("pattern2.png"),30,-15)
|
||||||
|
|
Loading…
Reference in New Issue