Last active
September 2, 2016 17:50
-
-
Save Shujito/6f1f8669e82b787b2462 to your computer and use it in GitHub Desktop.
This is an idea I have
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local STATE_SELECT_SONG = 0 | |
local STATE_SELECT_CHART = 1 | |
local STATE_CONFIRM = 2 | |
local function makeBackgroundOrnaments(self) | |
-- TODO | |
end | |
local function makeForegroundOrnaments(self) | |
-- TODO | |
end | |
local function makeRoulette(self) | |
-- TODO | |
end | |
local function makeGroupDisplay(self) | |
-- TODO | |
end | |
local function makeChartDisplay(self) | |
-- TODO | |
end | |
return function() | |
local screen = stomp.screens.select:new(function(self) | |
self.state = STATE_SELECT_SONG | |
makeBackgroundOrnaments(self) | |
self.songroulette = makeRoulette(self) | |
self.groupdisplay = makeGroupDisplay(self) | |
self.chartdisplay = makeChartDisplay(self) | |
makeForegroundOrnaments(self) | |
end) | |
screen:onkeydown(function(self,event) | |
if self.lockinput then return end | |
if event.key == stomp.keys.downleft then | |
if self.state == STATE_SELECT_SONG then | |
self:prevsong() | |
elseif self.state == STATE_SELECT_CHART then | |
self:prevchart(event.player) | |
end | |
elseif event.key == stomp.keys.downright then | |
if self.state == STATE_SELECT_SONG then | |
self:nextsong() | |
elseif self.state == STATE_SELECT_CHART then | |
self:nextchart(event.player) | |
end | |
elseif event.key == stomp.keys.upleft then | |
if self.state == STATE_SELECT_SONG then | |
self:prevgroup() | |
elseif self.state == STATE_SELECT_CHART then | |
self.state = STATE_SELECT_SONG | |
self.chartdisplay:hide() | |
end | |
elseif event.key == stomp.keys.right then | |
if self.state == STATE_SELECT_SONG then | |
self:nextgroup() | |
elseif self.state == STATE_SELECT_CHART then | |
self.state = STATE_SELECT_SONG | |
self.chartdisplay:hide() | |
end | |
elseif event.key == stomp.keys.center then | |
if self.state == STATE_SELECT_SONG then | |
self.state = STATE_SELECT_CHART | |
self.chartdisplay:show() | |
elseif self.state == STATE_SELECT_CHART then | |
self.state = STATE_CONFIRM | |
self.chartdisplay:highlight(event.player) | |
elseif self.state = STATE_CONFIRM then | |
self:finish() | |
end | |
end | |
end) | |
screen:onsongchanged(function(self,song) | |
self.songdisplay:settext(song:name()) | |
self.songdisplay:restart() | |
self.lockinput = true | |
song:charts(function(songs) | |
self.lockinput = false | |
self.chartdisplay:update(songs) | |
end) | |
end) | |
return screen | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 2011 | |
local function makepart( graphic, bounds ) | |
return { | |
texture = graphic, | |
animation = bounds, | |
} | |
end | |
local arrowanimation = { | |
{0, 0,64,64}, | |
{64, 0,64,64}, | |
{128,0,64,64}, | |
{192,0,64,64}, | |
{256,0,64,64}, | |
{320,0,64,64}, | |
} | |
local topanimation = { | |
{0, 64,64,64}, | |
{64, 64,64,64}, | |
{128,64,64,64}, | |
{192,64,64,64}, | |
{256,64,64,64}, | |
{320,64,64,64}, | |
} | |
local bodybounds = { {384,0,64,64} } | |
local bottombounds = { {384,64,64,64} } | |
local effbounds = { {448,0,64,64} } | |
local glowbounds = { {448,64,64,64} } | |
local function makebutton( graphic ) | |
return { | |
-- the arrow graphic | |
tap = makepart(graphic, arrowanimation ), | |
-- longnote graphics | |
holdtop = makepart( graphic, topanimation ), | |
holdmiddle = makepart( graphic, bodybounds ), | |
holdbottom = makepart( graphic, bottombounds ), | |
-- the push 'effect' when pressing the arrow panel | |
--eff = makepart( graphic, effbounds ), | |
eff = { | |
texture = graphic, | |
coords = {448,0,64,64}, | |
}, | |
-- the glow effect when hitting arrows | |
--glow = makepart( graphic, glowbounds ), | |
glow = { | |
texture = graphic, | |
coords = {448,64,64,64}, | |
}, | |
} | |
end | |
local noteskin = {} | |
noteskin.center = makebutton "center.png" | |
noteskin.upleft = makebutton "upleft.png" | |
noteskin.upright = makebutton "upright.png" | |
noteskin.downleft = makebutton "downleft.png" | |
noteskin.downright = makebutton "downright.png" | |
noteskin.receptor = { | |
blink = { | |
-- INSTANT, SMOOTH | |
type = INSTANT, | |
-- 2 values, should add up 1.0 | |
timing = { 0.5,0.5 }, | |
}, | |
base = { | |
texture = "receptor.png", | |
coords = { 0,0,256,64 }, | |
}, | |
overlay = { | |
texture = "receptor.png", | |
coords = { 0,64,256,64 }, | |
} | |
} | |
--[[ | |
noteskin.spark = { | |
texture = "spark.png", | |
animation = { | |
{ 0,0,256,256}, | |
{ 256,0,256,256}, | |
{ 512,0,256,256}, | |
{ 768,0,256,256}, | |
{1024,0,256,256}, | |
{1280,0,256,256} | |
} | |
} | |
--]] | |
return noteskin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return function() | |
local screen = Screen:new(function(self) | |
self.bg = self:addsprite('resources/bg.png') | |
self.bg:center(320,0) | |
self.bg:bounds(0,0,640,480) | |
self.text = Sprite:newtext('resources/impact 64px.txt',640) | |
self.text:pos(0,240) | |
self:addsprite(self.text) | |
end) | |
screen:onscreenin(function(self) | |
-- must set text here (why, go figure, or help me) | |
self.text:settext("Grumpy Wizards make toxic brew for The Evil Queen and Jack") | |
end) | |
return screen | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Screen = stomp.screen | |
local Music = stomp.screen.music | |
local title = Screen:new(function(self) | |
-- load some music | |
self.music = Music:new('music.ogg') | |
-- add a sprite and stretch | |
self.bg = self:addsprite('bg.png') | |
self.bg:bounds(0,0,640,480) | |
self.bg:center(320,0) | |
-- another sprite, used for fading the screen | |
self.black = self:addsprite('_black.png') | |
self.black:bounds(0,0,2,2) | |
self.black:center(320,0) | |
self.black:scale(640/2,480/2) | |
-- fade-in animation | |
self.black.fadein = self.black:addanimation() | |
self.black:alpha(1) | |
self.black:addstate(1000) | |
self.black:alpha(0) | |
-- fade-out animation | |
self.black.fadeout = self.black:addanimation() | |
self.black:alpha(0) | |
self.black:addstate(1000) | |
self.black:alpha(1) | |
end) | |
title:timer(30000) | |
title:timeout(500) | |
title:screenin(function(self) | |
self.music:play() | |
-- fade-in when entering the screen | |
self.black:setanimation(self.black.fadein) | |
self.black:restart() | |
end) | |
title:screenout(function(self) | |
self.music:stop() | |
-- fade-out when leaving screen | |
self.black:setanimation(self.black.fadeout) | |
self.black:restart() | |
end) | |
title:screenoff(function(self) end) | |
title:input(function(self,key,press) | |
if press and key == P1_CENTER or key == P2_CENTER then | |
-- finish by pressing any center | |
self:finish() | |
end | |
end) | |
title:update(function(self,time,delta) | |
-- spamming the log! | |
-- print(string.format('delta:%.2f', delta/60)) | |
end) | |
-- no screen | |
title:next(function(self) return nil end) | |
return title |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment