Skip to content

Commit

Permalink
DiscoWindows
Browse files Browse the repository at this point in the history
  • Loading branch information
derekargueta committed Sep 27, 2013
0 parents commit 35e4a77
Show file tree
Hide file tree
Showing 27 changed files with 941 additions and 0 deletions.
Binary file added Music/ACDC - Highway to hell.mp3
Binary file not shown.
Binary file added Music/Arctic Monkeys - Fluorescent Adolescent.mp3
Binary file not shown.
Binary file added Music/Bass_Cannon_-_Flux_Pavilion.mp3
Binary file not shown.
Binary file not shown.
Binary file added Music/FTP - Call It What You Want.mp3
Binary file not shown.
Binary file added Music/bot_mov_1.mp3
Binary file not shown.
Binary file added Music/cold_play_-_viva_la_vida.mp3
Binary file not shown.
36 changes: 36 additions & 0 deletions Notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
~~~NOTES~~~~
1) Things we still need to accomplish
-- make the tiles "flash" to the beat of the music (see bpm's below)
-- find way to switch around the big tiles for increased difficulty
-- full database of music

2) fun things to add
-- below the game in the empty space have a "power bar" type thing, or
some sort of meter
-- would an animated background be asking for too much...?
-- randomly throughout gameplay have spontaneous words pop up
and fade out, based on the player's gameplay. i.e. "awesome!", "fantastic!"
or "boo!", "you can do better!"
-- improve the score display
-- for the player to have the ability to choose the genre of music and difficulty

~~~ OTHER NOTES ~~~~~~
My display code is pretty sloppy and excessive. I figured for now it's not a
big deal, but later when we add other stuff we're going to want to minimize
the code so it would be best to start optimizing the display code

ABOUT STORYBOARD
Lua seems to run everything at once, not waiting for the previous thing to
finish, like Java. This will make "multithreading" easy but to get everything
to run in order (menu, animation, gameplay...) I used Corona's storyboard,
which is basically a way to control the flow of different "scenes" in the game.
It's pretty easy to use. Each script file can be a "scene" (or you can have
multiple scenes in one file) Just look at my code and you can figure it out
quickly.

http://docs.coronalabs.com/api/
^^or look at the docs^^

I think that that's everything. The code should all be well-commented so you
shouldn't have toooo much trouble following it.]
LESSSGOOOOO
Binary file added Pictures/bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/blueFlash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/greenFlash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/loser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/open box.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/orangeBackground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/playbutton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/redFlash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/yellowFlash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
application =
{
content =
{
width=320,
height=480,
scale = "letterbox",

imageSuffix =
{
["Button"] = .1
},
},
}
400 changes: 400 additions & 0 deletions gameScene2.lua

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
------------------------------------------------------------------------
------------------- STORYBOARD -----------------------------------------
--------- the main file, where the whole application starts ------------
------------------------------------------------------------------------

-- Load external libraries ---------------------------------------------
local storyboard = require "storyboard" -- standard Corona SDK library
------------------------------------------------------------------------

local theTimer

-- make a display group to hold all the display objects for easy disposal
local dispGroup = display.newGroup()

-- function to be called which will go to the menu and destroy all the display objects in thie script
local nextScene = function()
storyboard.gotoScene("menu") -- go the "menu"
dispGroup:removeSelf() -- destroy display
dispGroup = nil -- free up some memory
end


---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
------------------------ This portion is the pre-game animation -----------------------------
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
local function move()
square = display.newRect( 0, 0, 100, 100 ) -- create a new rectangle
square:setFillColor( 255,255,255 ) -- give it some color
dispGroup:insert(square) -- add it to the display group

-- store w and h with the width and height of the screen (?)
local w,h = display.contentWidth, display.contentHeight

square2 = display.newRect( 0, 0, 100, 100 ) -- a second rectangle of same size
square2:setFillColor( 255,255,255 ) -- and same color
dispGroup:insert(square2) -- and add it to the display group

local w,h = display.contentWidth, display.contentHeight

-- (1) move square2 to bottom right corner; subtract half side-length
-- b/c the local origin is at the square's center; fade out square2
transition.to( square, { time=500, alpha=1.0, x=(w-10), y=(h-10) } )

-- (2) fade square2 back in after 2.5 seconds
transition.to( square, { time=500, delay = 0, alpha=0 } )

-- (3) square (the first square) never moves or animates
end

---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------


move() -- call the animation function
theTimer = timer.performWithDelay(1000, nextScene, 1) -- give the animation one second to run before called the nextScene function
105 changes: 105 additions & 0 deletions menu.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
-----------------------------------------------------
-- this file is the "menu". All it has at the moment is a play button
-----------------------------------------------------

-- load external libraries ---------------------------------------------------
local storyboard = require "storyboard" -- standard Corona SDK library
------------------------------------------------------------------------------

-- make an object called scene which is a scene object of the storyboard
local scene = storyboard.newScene()

----------------------------- MAKE AN ARRAY OF ALL THE SONGZ AND THEIR NAMEZ----------------------------------
fileList = {}
songList = {}
bpm = {}

fileList[0] = "Music/ACDC - Highway to hell.mp3" songList[0] = "Highway to Hell by ACDC" bpm[0] = 513
fileList[1] = "Music/Arctic Monkeys - Fluorescent Adolescent.mp3" songList[1] = "Fluorescent Adolescent by Arctic Monkeys" bpm[1] = 1000
fileList[2] = "Music/cold_play_-_viva_la_vida.mp3" songList[2] = "Viva la Vida by Coldplay" bpm[2] = 1000
fileList[3] = "Music/Daft Punk - Harder, Better, Faster, Stronger.mp3" songList[3] = "Harder, Better, Faster, Stronger by Daft Punk" bpm[3] = 1000
fileList[4] = "Music/Bass_Cannon_-_Flux_Pavilion.mp3" songList[4] = "Bass Cannon by Flux Pavilion" bpm[4] = 1000

--------------------------------------------------------------------------------------------------------------
index = 0 -- will be used to reference the arrays and the songs



function scene:enterScene( event ) -- function to be called when the scene "enters"
local group = display.newGroup() -- a group to round up and hold all diplay objects
local playButton = display.newImage("Pictures/playbutton.png", 0, 0, true) -- draw the image
playButton.x = 160 playButton.y = 100 -- set the image location
group:insert(playButton) -- add the playButton to the display group

local comment = display.newText("Select your Song!",35,255,250,50,nil, 30) -- just some helpful text set right above the song selector
group:insert(comment) -- add to the display group

--Sets up the buttons that will allow the user to pick a song--
local songButton = display.newText(songList[0],35,300,250,100,nil, 30) -- position and display song choice
group:insert(songButton) -- add to the display group
local nextButton = display.newRect(290, 300, 30, 100) -- position and display next song button
nextButton:setFillColor(72, 157, 243) -- set color of next song button
group:insert(nextButton) -- add to the display group
local prevButton = display.newRect(0, 300, 30, 100) -- position and display previous song button
prevButton:setFillColor(72, 157, 243) -- set color of previous song button
group:insert(prevButton) -- add to the display group

local function clickBack( event )
--NO TOUCHY
local t = event.target
local phase = event.phase
------------------------

if "began" == phase then
if index == 0 then -- if you hit the end of the array...
index = table.getn(fileList) -- go back to the beginning
else -- otherwise continue to increase the index
index = index-1
end
group:remove(songButton) -- remove the songButton from the display group to avoid stack overflow
songButton:removeSelf() -- removes the songButton in order to be replaced in the next line
songButton = display.newText(songList[index], 35, 300,250,100,nil, 30) -- position and display next song choice
group:insert(songButton) -- add the new songButton to the display group
end
end

local function clickNext( event ) -- called when the next song button is touched
--NO TOUCHY
local t = event.target
local phase = event.phase
------------------------

if "began" == phase then
if index == table.getn(songList) then -- if you hit the end of the array...
index = 0 -- go back to the beginning
else -- otherwise continue to increase the index
index = index+1
end
group:remove(songButton) -- remove the songButton from the display group to avoid stack overflow
songButton:removeSelf() -- removes the songButton in order to be replaced in the next line
songButton = display.newText(songList[index], 35, 300,250,100,nil, 30) -- position and display next song choice
group:insert(songButton) -- add the new songButton to the display group
end
end

local function listenerEvent( event ) -- called when the play button is touched
--NO TOUCHY
local t = event.target
local phase = event.phase
------------------------

if "began" == phase then
group:removeSelf()
group = nil
storyboard.gotoScene( "gameScene") -- go the "gameScene" which is the actual game portion
end
end

playButton:addEventListener( "touch", listenerEvent) -- add a listener for when someone touches the playButton, go to the function listenerEvent
nextButton:addEventListener( "touch", clickNext) -- add a listener for when someone touches the nextButton
prevButton:addEventListener( "touch", clickBack) -- add a listener for when someone touches the prevButton
end

scene:addEventListener( "enterScene", scene) -- give the scene a listener for when it enters

return scene -- return the script as a scene object
35 changes: 35 additions & 0 deletions test.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
-----------------------------------------------------------------------
-- This is the script called when the person playing the game loses
-----------------------------------------------------------------------

-- Load external libraries ---------------------------------------------
local storyboard = require "storyboard" -- standard Corona SDK library
------------------------------------------------------------------------

-- create an object called scene which is a scene object of storyboard
local scene = storyboard.newScene()

function scene:enterScene( event ) -- function to be called when the scene "enters"

-- draw the image
local disp = display.newImage("Pictures/loser.png", 0, 0, true)
disp.x = 160 disp.y = 170 -- set the image's location

function click( event ) -- function to be called when the loser button is touched
--NO TOUCHY
local t = event.target
local phase = event.phase
------------------------

if "began" == phase then
storyboard.gotoScene( "menu") -- when the loser button is touched go back to the menu
disp:removeSelf() -- and destroy all display/listeners in this script
end
end

disp:addEventListener( "touch", click) -- add a listener to the loser button AKA "disp"
end

scene:addEventListener( "enterScene", scene) -- give this scene a listener for when it enters

return scene -- return this script as a scene object
Loading

0 comments on commit 35e4a77

Please sign in to comment.