From 886c23946f24f98b69efdd6476a4185e4e911c6d Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Mon, 21 Mar 2016 21:47:17 -0400 Subject: [PATCH 01/46] Create intialstatement.md --- intialstatement.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 intialstatement.md diff --git a/intialstatement.md b/intialstatement.md new file mode 100644 index 0000000..8dcb172 --- /dev/null +++ b/intialstatement.md @@ -0,0 +1,35 @@ +# Initial Project Statement + +## Objective +Simple 2D side-scrolling platformer with various obstacles such as bots and terrain using unity and c# + +## Motivations +Our motivation comes from the simplicity a platformer gives as well as the side scrolling possibility that gives a platform its unique appearance. We chose to create a platformer because it is one of the main genres of gaming which dwells on the curiosity we had in our childhood on the gameplay and now with our developing abilities with code, we can further our understanding of games and break the creation down to our understanding. + +## Languages +C# and Unity + +## Technology +We plan on using monodevelop or visual studio for coding in c# +to design the game we will use unity. + +## Benefits +How will you benefit from this project? +We will learn to code in c# and further develop our passion for computer science and game programing. Hopefully, this project will open our minds to the various applications for computer science in our daily and professional lives. + +## Foreseeable Challenges +- Learning a new programming language +- Artwork for the game +- Debugging the game +- Creating the basic foundation of its functionality +- Time management + + + +## High-Level Learning & Action Outline + * Brainstorm application functionality - 1 Week + * Learn C# and Unity - 5 Weeks + * Application Mock-Ups - 1 Week + * Development - 6 Weeks + * Testing & Fixing - 1 Week + * Documentation - 1 Week From acc61ab0ffb7270fa4242c8c86d76e3901084712 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Mon, 21 Mar 2016 21:47:41 -0400 Subject: [PATCH 02/46] Rename intialstatement.md to initialstatement.md --- intialstatement.md => initialstatement.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename intialstatement.md => initialstatement.md (100%) diff --git a/intialstatement.md b/initialstatement.md similarity index 100% rename from intialstatement.md rename to initialstatement.md From 052c80b7cdf5fe0c6668121001be27477dac91a1 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Mon, 21 Mar 2016 21:49:31 -0400 Subject: [PATCH 03/46] Update initialstatement.md --- initialstatement.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/initialstatement.md b/initialstatement.md index 8dcb172..c32bec3 100644 --- a/initialstatement.md +++ b/initialstatement.md @@ -24,8 +24,6 @@ We will learn to code in c# and further develop our passion for computer science - Creating the basic foundation of its functionality - Time management - - ## High-Level Learning & Action Outline * Brainstorm application functionality - 1 Week * Learn C# and Unity - 5 Weeks @@ -33,3 +31,9 @@ We will learn to code in c# and further develop our passion for computer science * Development - 6 Weeks * Testing & Fixing - 1 Week * Documentation - 1 Week + +##Members +- Koven Wei +- John Han +- Yutaro Miyata +- Matthew Hope From ee03afaeec7f796b386f95f8e451fab4958b7229 Mon Sep 17 00:00:00 2001 From: johnswanson3 Date: Mon, 21 Mar 2016 22:50:54 -0400 Subject: [PATCH 04/46] Create initialprojectstatement.md --- initialprojectstatement.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 initialprojectstatement.md diff --git a/initialprojectstatement.md b/initialprojectstatement.md new file mode 100644 index 0000000..8dcb172 --- /dev/null +++ b/initialprojectstatement.md @@ -0,0 +1,35 @@ +# Initial Project Statement + +## Objective +Simple 2D side-scrolling platformer with various obstacles such as bots and terrain using unity and c# + +## Motivations +Our motivation comes from the simplicity a platformer gives as well as the side scrolling possibility that gives a platform its unique appearance. We chose to create a platformer because it is one of the main genres of gaming which dwells on the curiosity we had in our childhood on the gameplay and now with our developing abilities with code, we can further our understanding of games and break the creation down to our understanding. + +## Languages +C# and Unity + +## Technology +We plan on using monodevelop or visual studio for coding in c# +to design the game we will use unity. + +## Benefits +How will you benefit from this project? +We will learn to code in c# and further develop our passion for computer science and game programing. Hopefully, this project will open our minds to the various applications for computer science in our daily and professional lives. + +## Foreseeable Challenges +- Learning a new programming language +- Artwork for the game +- Debugging the game +- Creating the basic foundation of its functionality +- Time management + + + +## High-Level Learning & Action Outline + * Brainstorm application functionality - 1 Week + * Learn C# and Unity - 5 Weeks + * Application Mock-Ups - 1 Week + * Development - 6 Weeks + * Testing & Fixing - 1 Week + * Documentation - 1 Week From efe27ea61ff7d2a554f858272de8a1262236c9dd Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 18:49:18 -0400 Subject: [PATCH 05/46] Testing --- Koven's Part.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 Koven's Part.py diff --git a/Koven's Part.py b/Koven's Part.py new file mode 100644 index 0000000..60bc259 --- /dev/null +++ b/Koven's Part.py @@ -0,0 +1 @@ +"test" \ No newline at end of file From e7d0b554b7cfbdbd67ca60cc45c25430dce51545 Mon Sep 17 00:00:00 2001 From: johnswanson3 Date: Wed, 15 Jun 2016 06:54:04 +0800 Subject: [PATCH 06/46] Create PCP --- PCP | 1 + 1 file changed, 1 insertion(+) create mode 100644 PCP diff --git a/PCP b/PCP new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/PCP @@ -0,0 +1 @@ + From d5cbd939d8b19b7802064d2deb2f7a88f5d8d03f Mon Sep 17 00:00:00 2001 From: johnswanson3 Date: Wed, 15 Jun 2016 06:54:26 +0800 Subject: [PATCH 07/46] Delete PCP --- PCP | 1 - 1 file changed, 1 deletion(-) delete mode 100644 PCP diff --git a/PCP b/PCP deleted file mode 100644 index 8b13789..0000000 --- a/PCP +++ /dev/null @@ -1 +0,0 @@ - From fd0f9c6c2072e9df73abab89b25ee3c985d340bb Mon Sep 17 00:00:00 2001 From: johnswanson3 Date: Wed, 15 Jun 2016 06:54:39 +0800 Subject: [PATCH 08/46] Create PCP.py --- PCP.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 PCP.py diff --git a/PCP.py b/PCP.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/PCP.py @@ -0,0 +1 @@ + From a4c3acb3f04c91ef04439de933a2e8d2a6c48225 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 19:03:19 -0400 Subject: [PATCH 09/46] Delete Koven's Part.py --- Koven's Part.py | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Koven's Part.py diff --git a/Koven's Part.py b/Koven's Part.py deleted file mode 100644 index 60bc259..0000000 --- a/Koven's Part.py +++ /dev/null @@ -1 +0,0 @@ -"test" \ No newline at end of file From f388188d4880b0e9849dba7539a42c1e2bfb3439 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 19:04:01 -0400 Subject: [PATCH 10/46] created file --- mixtape_jump.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 mixtape_jump.py diff --git a/mixtape_jump.py b/mixtape_jump.py new file mode 100644 index 0000000..e69de29 From 82b13c8972aae5b4852c45bf04a77beefc197a87 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 19:04:59 -0400 Subject: [PATCH 11/46] Delete mixtape_jump.py --- mixtape_jump.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 mixtape_jump.py diff --git a/mixtape_jump.py b/mixtape_jump.py deleted file mode 100644 index e69de29..0000000 From 310981efcddcc73ebc58d2b7c9869269f67b892d Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 19:05:34 -0400 Subject: [PATCH 12/46] File Creation --- .idea/vcs.xml | 6 ++ mixtape_jump.py | 0 test.py | 256 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 262 insertions(+) create mode 100644 .idea/vcs.xml create mode 100644 mixtape_jump.py create mode 100644 test.py diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/mixtape_jump.py b/mixtape_jump.py new file mode 100644 index 0000000..e69de29 diff --git a/test.py b/test.py new file mode 100644 index 0000000..b31cab1 --- /dev/null +++ b/test.py @@ -0,0 +1,256 @@ +""" +*************************************************************************** +filename: mixtape_jump.py +description: A side scrolling game where the player (mixtape) must navigate through rappers and achieve a high score! +Author: Wei.K, Miyata.Y, Han.J +Created On: 06/13/2016 +*************************************************************************** +""" +import kivy +kivy.require('1.7.2') +from kivy.app import App +from kivy.uix.widget import Widget +from kivy.uix.label import Label +from kivy.uix.button import Button +from kivy.core.window import Window +from kivy.properties import NumericProperty +from kivy.clock import Clock +from kivy.graphics import Rectangle, Color, Canvas +from random import * + +#Background color (Black) +Window.clearcolor = (0,0,0,1.) + +class WidgetDrawer(Widget): +#This widget is used to draw all of the objects on the screen +#This initializes widget movement, size, positioning +#objects of this class must be initiated with an image string +#with asterisks, Kwargs allow to pass all arguments without needing its parameters + def __init__(self, imageStr, **kwargs): + super(WidgetDrawer, self).__init__(**kwargs) #this is part of the **kwargs notation +#if you haven't seen with before, here's a link http://effbot.org/zone/python-with-statement.html + with self.canvas: +#this line creates a rectangle with the image drawn on top + self.size = (Window.width*.005*25,Window.height*.005*25) + self.rect_bg= Rectangle(source=imageStr,pos=self.pos,size = self.size) +#this line calls the update_graphics_pos function every time the position variable is modified + self.bind(pos=self.update_graphics_pos) + self.x = self.center_x + self.y = self.center_y +#center the widget + self.pos = (self.x,self.y) +#center the rectangle on the widget + self.rect_bg.pos = self.pos + + def update_graphics_pos(self, instance, value): +#if the widgets position moves, the rectangle that contains the image is also moved + self.rect_bg.pos = value +#use this function to change widget size + def setSize(self,width, height): + self.size = (width, height) + def setPos(self,xpos,ypos): + self.x = xpos + self.y = ypos + + +class rapper(WidgetDrawer): + #rapper class. The flappy mixtape will dodge these + velocity_x = NumericProperty(0) #initialize velocity_x and velocity_y + velocity_y = NumericProperty(0) #declaring variables is not necessary in python + #update the position using the velocity defined here. every time move is called we change the position by velocity_x + def move(self): + self.x = self.x + self.velocity_x + self.y = self.y + self.velocity_y + def update(self): +#the update function moves the astreoid. Other things could happen here as well (speed changes for example) + self.move() + + +class mixtape(WidgetDrawer): + #mixtape class. This is for the main mixtape object. + #velocity of mixtape on x/y axis + def __init__(self, imageStr) : + WidgetDrawer.__init__(self, imageStr) + self.impulse = 3 #this variable will be used to move the mixtape up + self.grav = -0.1 #this variable will be used to pull the mixtape down + + self.velocity_x = 0 #we wont actually use x movement + self.velocity_y = 0 + + self.setSize(50, 30) + + def setSize (self, width, height): + WidgetDrawer.setSize(self, width, height) + + def move(self): + self.x = self.x + self.velocity_x + self.y = self.y + self.velocity_y + + #don't let the mixtape go too far + if self.y > Window.height*0.95: #don't let the mixtape go up too high + self.impulse = -3 + + def determineVelocity(self): + #move the mixtape up and down + #we need to take into account our acceleration + #also want to look at gravity + self.grav = self.grav*1.05 #the gravitational velocity should increase + #set a grav limit + if self.grav < -4: #set a maximum falling down speed (terminal velocity) + self.grav = -4 + #the mixtape has a propety called self.impulse which is updated + #whenever the player touches, pushing the mixtape up + #use this impulse to determine the mixtape velocity + #also decrease the magnitude of the impulse each time its used + + self.velocity_y = self.impulse + self.grav + self.impulse = 0.95*self.impulse #make the upward velocity decay + + def update(self): + self.determineVelocity() #first figure out the new velocity + self.move() #now move the mixtape + + +class MyButton(Button): + #class used to get uniform button styles + def __init__(self, **kwargs): + super(MyButton, self).__init__(**kwargs) + #all we're doing is setting the font size. more can be done later + self.font_size = Window.width*0.018 + + +class GUI(Widget): + #this is the main widget that contains the game. + rapperList =[] #use this to keep track of rappers + rapperScore = NumericProperty(0) + minProb = 1780 #this variable used in spawning rappers + def __init__(self, **kwargs): + super(GUI, self).__init__(**kwargs) + self.score = Label(text = "0") + self.score.y = Window.height*0.8 + self.score.x = Window.width*0.2 + self.rapperScore = 0 + l = Label(text='Mixtape Jump') #give the game a title + l.x = Window.width/2 - l.width/2 + l.y = Window.height*0.8 + self.add_widget(l) #add the label to the screen + + #now we create a mixtape object + #notice how we specify the mixtape image + self.mixtape = mixtape(imageStr = 'C:\Users\Koven\desktop\photoshopped\mmixtape.png') + self.mixtape.x = Window.width/4 + self.mixtape.y = Window.height/2 + self.add_widget(self.mixtape) + + + def check_score(self,obj): + #update credits + self.score.text = str(self.rapperScore) + + self.bind(rapperScore = check_score) + self.add_widget(self.score) + + + def addrapper(self): + #add an rapper to the screen + #self.rapper + imageNumber = randint(1,7) + imageStr = ('C:\Users\Koven\desktop\photoshopped\image'+str(imageNumber)+'.png') + tmprapper = rapper(imageStr) + tmprapper.x = Window.width*0.99 + #randomize y position + ypos = randint(2,25) + ypos = ypos*Window.height*.0625 + tmprapper.y = ypos + tmprapper.velocity_y = 0 + vel = 10 + tmprapper.velocity_x = -0.1*vel + self.rapperList.append(tmprapper) + self.add_widget(tmprapper) + + #handle input events + #kivy has a great event handler. the on_touch_down function is already recognized + #and doesn't need t obe setup. Every time the screen is touched, the on_touch_down function is called + def on_touch_down(self, touch): + self.mixtape.impulse = 3 #give the mixtape an impulse + self.mixtape.grav = -0.1 #reset the gravitational velocity + + def gameOver(self): #this function is called when the game ends + #add a restart button + restartButton = MyButton(text='Press to Restart, your score was ' + str(self.rapperScore)) + def restart_button(obj): + #this function will be called whenever the reset button is pushed + print 'restart button pushed' + #reset game + for k in self.rapperList: + self.remove_widget(k) + self.mixtape.xpos = Window.width*0.25 + self.mixtape.ypos = Window.height*0.5 + self.minProb = 1780 + self.rapperList = [] + + self.parent.remove_widget(restartButton) + #stop the game clock in case it hasn't already been stopped + Clock.unschedule(self.update) + #start the game clock + Clock.schedule_interval(self.update, 1.0/60.0) + restartButton.size = (Window.width*.3,Window.width*.1) + restartButton.pos = Window.width*0.5-restartButton.width/2, Window.height*0.5 + #bind the button using the built-in on_release event + #whenever the button is released, the restart_button function is called + restartButton.bind(on_release=restart_button) + + #*** It's important that the parent get the button so you can click on it + #otherwise you can't click through the main game's canvas + self.parent.add_widget(restartButton) + + + def update(self,dt): + #This update function is the main update function for the game + #All of the game logic has its origin here + #events are setup here as well + #update game objects + #update mixtape + self.mixtape.update() + #update rappers + #randomly add an rapper + tmpCount = randint(1,1800) + print self.minProb + if tmpCount > self.minProb: + self.addrapper() + self.minProb = self.minProb - 0.10 + if self.minProb <= 1750: + self.minProb = self.minProb + 0.1 + if self.mixtape.y < Window.height * 0.001: + self.mixtape.impulse = 10 + for k in self.rapperList: + #check for collision with mixtape + if k.collide_widget(self.mixtape): + print 'death' + #game over routine + self.gameOver() + Clock.unschedule(self.update) + self.rapperScore = 0 + #add reset button + if k.x < -100: + self.remove_widget(k) + self.rapperScore += 1 + tmpRapperList = self.rapperList + tmpRapperList[:] = [x for x in tmpRapperList if (x.x > - 100)] + self.RapperList = tmpRapperList + k.update() + +class ClientApp(App): + + def build(self): + #this is where the root widget goes + #should be a canvas + parent = Widget() #this is an empty holder for buttons, etc + app = GUI() + #Start the game clock (runs update function once every (1/60) seconds + Clock.schedule_interval(app.update, 1.0/60.0) + parent.add_widget(app) #use this hierarchy to make it easy to deal w/buttons + return parent + +if __name__ == '__main__' : + ClientApp().run() \ No newline at end of file From 95cde6658dddfa6bca18cd035fca9dc48ee1193f Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 19:06:18 -0400 Subject: [PATCH 13/46] Delete test.py --- test.py | 256 -------------------------------------------------------- 1 file changed, 256 deletions(-) delete mode 100644 test.py diff --git a/test.py b/test.py deleted file mode 100644 index b31cab1..0000000 --- a/test.py +++ /dev/null @@ -1,256 +0,0 @@ -""" -*************************************************************************** -filename: mixtape_jump.py -description: A side scrolling game where the player (mixtape) must navigate through rappers and achieve a high score! -Author: Wei.K, Miyata.Y, Han.J -Created On: 06/13/2016 -*************************************************************************** -""" -import kivy -kivy.require('1.7.2') -from kivy.app import App -from kivy.uix.widget import Widget -from kivy.uix.label import Label -from kivy.uix.button import Button -from kivy.core.window import Window -from kivy.properties import NumericProperty -from kivy.clock import Clock -from kivy.graphics import Rectangle, Color, Canvas -from random import * - -#Background color (Black) -Window.clearcolor = (0,0,0,1.) - -class WidgetDrawer(Widget): -#This widget is used to draw all of the objects on the screen -#This initializes widget movement, size, positioning -#objects of this class must be initiated with an image string -#with asterisks, Kwargs allow to pass all arguments without needing its parameters - def __init__(self, imageStr, **kwargs): - super(WidgetDrawer, self).__init__(**kwargs) #this is part of the **kwargs notation -#if you haven't seen with before, here's a link http://effbot.org/zone/python-with-statement.html - with self.canvas: -#this line creates a rectangle with the image drawn on top - self.size = (Window.width*.005*25,Window.height*.005*25) - self.rect_bg= Rectangle(source=imageStr,pos=self.pos,size = self.size) -#this line calls the update_graphics_pos function every time the position variable is modified - self.bind(pos=self.update_graphics_pos) - self.x = self.center_x - self.y = self.center_y -#center the widget - self.pos = (self.x,self.y) -#center the rectangle on the widget - self.rect_bg.pos = self.pos - - def update_graphics_pos(self, instance, value): -#if the widgets position moves, the rectangle that contains the image is also moved - self.rect_bg.pos = value -#use this function to change widget size - def setSize(self,width, height): - self.size = (width, height) - def setPos(self,xpos,ypos): - self.x = xpos - self.y = ypos - - -class rapper(WidgetDrawer): - #rapper class. The flappy mixtape will dodge these - velocity_x = NumericProperty(0) #initialize velocity_x and velocity_y - velocity_y = NumericProperty(0) #declaring variables is not necessary in python - #update the position using the velocity defined here. every time move is called we change the position by velocity_x - def move(self): - self.x = self.x + self.velocity_x - self.y = self.y + self.velocity_y - def update(self): -#the update function moves the astreoid. Other things could happen here as well (speed changes for example) - self.move() - - -class mixtape(WidgetDrawer): - #mixtape class. This is for the main mixtape object. - #velocity of mixtape on x/y axis - def __init__(self, imageStr) : - WidgetDrawer.__init__(self, imageStr) - self.impulse = 3 #this variable will be used to move the mixtape up - self.grav = -0.1 #this variable will be used to pull the mixtape down - - self.velocity_x = 0 #we wont actually use x movement - self.velocity_y = 0 - - self.setSize(50, 30) - - def setSize (self, width, height): - WidgetDrawer.setSize(self, width, height) - - def move(self): - self.x = self.x + self.velocity_x - self.y = self.y + self.velocity_y - - #don't let the mixtape go too far - if self.y > Window.height*0.95: #don't let the mixtape go up too high - self.impulse = -3 - - def determineVelocity(self): - #move the mixtape up and down - #we need to take into account our acceleration - #also want to look at gravity - self.grav = self.grav*1.05 #the gravitational velocity should increase - #set a grav limit - if self.grav < -4: #set a maximum falling down speed (terminal velocity) - self.grav = -4 - #the mixtape has a propety called self.impulse which is updated - #whenever the player touches, pushing the mixtape up - #use this impulse to determine the mixtape velocity - #also decrease the magnitude of the impulse each time its used - - self.velocity_y = self.impulse + self.grav - self.impulse = 0.95*self.impulse #make the upward velocity decay - - def update(self): - self.determineVelocity() #first figure out the new velocity - self.move() #now move the mixtape - - -class MyButton(Button): - #class used to get uniform button styles - def __init__(self, **kwargs): - super(MyButton, self).__init__(**kwargs) - #all we're doing is setting the font size. more can be done later - self.font_size = Window.width*0.018 - - -class GUI(Widget): - #this is the main widget that contains the game. - rapperList =[] #use this to keep track of rappers - rapperScore = NumericProperty(0) - minProb = 1780 #this variable used in spawning rappers - def __init__(self, **kwargs): - super(GUI, self).__init__(**kwargs) - self.score = Label(text = "0") - self.score.y = Window.height*0.8 - self.score.x = Window.width*0.2 - self.rapperScore = 0 - l = Label(text='Mixtape Jump') #give the game a title - l.x = Window.width/2 - l.width/2 - l.y = Window.height*0.8 - self.add_widget(l) #add the label to the screen - - #now we create a mixtape object - #notice how we specify the mixtape image - self.mixtape = mixtape(imageStr = 'C:\Users\Koven\desktop\photoshopped\mmixtape.png') - self.mixtape.x = Window.width/4 - self.mixtape.y = Window.height/2 - self.add_widget(self.mixtape) - - - def check_score(self,obj): - #update credits - self.score.text = str(self.rapperScore) - - self.bind(rapperScore = check_score) - self.add_widget(self.score) - - - def addrapper(self): - #add an rapper to the screen - #self.rapper - imageNumber = randint(1,7) - imageStr = ('C:\Users\Koven\desktop\photoshopped\image'+str(imageNumber)+'.png') - tmprapper = rapper(imageStr) - tmprapper.x = Window.width*0.99 - #randomize y position - ypos = randint(2,25) - ypos = ypos*Window.height*.0625 - tmprapper.y = ypos - tmprapper.velocity_y = 0 - vel = 10 - tmprapper.velocity_x = -0.1*vel - self.rapperList.append(tmprapper) - self.add_widget(tmprapper) - - #handle input events - #kivy has a great event handler. the on_touch_down function is already recognized - #and doesn't need t obe setup. Every time the screen is touched, the on_touch_down function is called - def on_touch_down(self, touch): - self.mixtape.impulse = 3 #give the mixtape an impulse - self.mixtape.grav = -0.1 #reset the gravitational velocity - - def gameOver(self): #this function is called when the game ends - #add a restart button - restartButton = MyButton(text='Press to Restart, your score was ' + str(self.rapperScore)) - def restart_button(obj): - #this function will be called whenever the reset button is pushed - print 'restart button pushed' - #reset game - for k in self.rapperList: - self.remove_widget(k) - self.mixtape.xpos = Window.width*0.25 - self.mixtape.ypos = Window.height*0.5 - self.minProb = 1780 - self.rapperList = [] - - self.parent.remove_widget(restartButton) - #stop the game clock in case it hasn't already been stopped - Clock.unschedule(self.update) - #start the game clock - Clock.schedule_interval(self.update, 1.0/60.0) - restartButton.size = (Window.width*.3,Window.width*.1) - restartButton.pos = Window.width*0.5-restartButton.width/2, Window.height*0.5 - #bind the button using the built-in on_release event - #whenever the button is released, the restart_button function is called - restartButton.bind(on_release=restart_button) - - #*** It's important that the parent get the button so you can click on it - #otherwise you can't click through the main game's canvas - self.parent.add_widget(restartButton) - - - def update(self,dt): - #This update function is the main update function for the game - #All of the game logic has its origin here - #events are setup here as well - #update game objects - #update mixtape - self.mixtape.update() - #update rappers - #randomly add an rapper - tmpCount = randint(1,1800) - print self.minProb - if tmpCount > self.minProb: - self.addrapper() - self.minProb = self.minProb - 0.10 - if self.minProb <= 1750: - self.minProb = self.minProb + 0.1 - if self.mixtape.y < Window.height * 0.001: - self.mixtape.impulse = 10 - for k in self.rapperList: - #check for collision with mixtape - if k.collide_widget(self.mixtape): - print 'death' - #game over routine - self.gameOver() - Clock.unschedule(self.update) - self.rapperScore = 0 - #add reset button - if k.x < -100: - self.remove_widget(k) - self.rapperScore += 1 - tmpRapperList = self.rapperList - tmpRapperList[:] = [x for x in tmpRapperList if (x.x > - 100)] - self.RapperList = tmpRapperList - k.update() - -class ClientApp(App): - - def build(self): - #this is where the root widget goes - #should be a canvas - parent = Widget() #this is an empty holder for buttons, etc - app = GUI() - #Start the game clock (runs update function once every (1/60) seconds - Clock.schedule_interval(app.update, 1.0/60.0) - parent.add_widget(app) #use this hierarchy to make it easy to deal w/buttons - return parent - -if __name__ == '__main__' : - ClientApp().run() \ No newline at end of file From a8b9434cda38e0d295fae98c76303dbf76a0a4b3 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 19:08:31 -0400 Subject: [PATCH 14/46] Delete PCP.py --- PCP.py | 1 - 1 file changed, 1 deletion(-) delete mode 100644 PCP.py diff --git a/PCP.py b/PCP.py deleted file mode 100644 index 8b13789..0000000 --- a/PCP.py +++ /dev/null @@ -1 +0,0 @@ - From 2ebd572280cda7095305443cba868dec4ee3d5b9 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 19:12:50 -0400 Subject: [PATCH 15/46] testing --- Koven's Part.py | 1 - mixtape_jump.py | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) delete mode 100644 Koven's Part.py diff --git a/Koven's Part.py b/Koven's Part.py deleted file mode 100644 index 60bc259..0000000 --- a/Koven's Part.py +++ /dev/null @@ -1 +0,0 @@ -"test" \ No newline at end of file diff --git a/mixtape_jump.py b/mixtape_jump.py index e69de29..30fde28 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -0,0 +1,3 @@ +test +test +test \ No newline at end of file From d885491adf3f99660b6f79f439066ec009939a33 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 19:23:14 -0400 Subject: [PATCH 16/46] testing --- mixtape_jump.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mixtape_jump.py b/mixtape_jump.py index e69de29..5dda6de 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -0,0 +1 @@ +testetestest \ No newline at end of file From 1ed90d635df7546ebaef45ecd38686079bff29ab Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 19:57:27 -0400 Subject: [PATCH 17/46] testing --- mixtape_jump.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mixtape_jump.py b/mixtape_jump.py index 5dda6de..b2d5ce0 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -1 +1 @@ -testetestest \ No newline at end of file +"testing" \ No newline at end of file From c355b09bb59300f23ec1e20c1db75d024dc28348 Mon Sep 17 00:00:00 2001 From: John Python Date: Wed, 15 Jun 2016 08:01:32 +0800 Subject: [PATCH 18/46] test1 --- mixtape_jump.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mixtape_jump.py b/mixtape_jump.py index e69de29..b2d5ce0 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -0,0 +1 @@ +"testing" \ No newline at end of file From cbf82e19c6b684cdf8b4a3f894c88b5a2a867743 Mon Sep 17 00:00:00 2001 From: johnswanson3 Date: Mon, 21 Mar 2016 22:50:54 -0400 Subject: [PATCH 19/46] Create initialprojectstatement.md --- initialprojectstatement.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 initialprojectstatement.md diff --git a/initialprojectstatement.md b/initialprojectstatement.md new file mode 100644 index 0000000..8dcb172 --- /dev/null +++ b/initialprojectstatement.md @@ -0,0 +1,35 @@ +# Initial Project Statement + +## Objective +Simple 2D side-scrolling platformer with various obstacles such as bots and terrain using unity and c# + +## Motivations +Our motivation comes from the simplicity a platformer gives as well as the side scrolling possibility that gives a platform its unique appearance. We chose to create a platformer because it is one of the main genres of gaming which dwells on the curiosity we had in our childhood on the gameplay and now with our developing abilities with code, we can further our understanding of games and break the creation down to our understanding. + +## Languages +C# and Unity + +## Technology +We plan on using monodevelop or visual studio for coding in c# +to design the game we will use unity. + +## Benefits +How will you benefit from this project? +We will learn to code in c# and further develop our passion for computer science and game programing. Hopefully, this project will open our minds to the various applications for computer science in our daily and professional lives. + +## Foreseeable Challenges +- Learning a new programming language +- Artwork for the game +- Debugging the game +- Creating the basic foundation of its functionality +- Time management + + + +## High-Level Learning & Action Outline + * Brainstorm application functionality - 1 Week + * Learn C# and Unity - 5 Weeks + * Application Mock-Ups - 1 Week + * Development - 6 Weeks + * Testing & Fixing - 1 Week + * Documentation - 1 Week From 37f8dc17476265782eb153c1c9adc37474002940 Mon Sep 17 00:00:00 2001 From: johnswanson3 Date: Wed, 15 Jun 2016 06:54:04 +0800 Subject: [PATCH 20/46] Create PCP --- PCP | 1 + 1 file changed, 1 insertion(+) create mode 100644 PCP diff --git a/PCP b/PCP new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/PCP @@ -0,0 +1 @@ + From 6f8fd4759ec172e067f7ad1f0427a9c96049fbd5 Mon Sep 17 00:00:00 2001 From: johnswanson3 Date: Wed, 15 Jun 2016 06:54:26 +0800 Subject: [PATCH 21/46] Delete PCP --- PCP | 1 - 1 file changed, 1 deletion(-) delete mode 100644 PCP diff --git a/PCP b/PCP deleted file mode 100644 index 8b13789..0000000 --- a/PCP +++ /dev/null @@ -1 +0,0 @@ - From 92839e955ff3e7e1b2e7aaceffed8346d3df4eea Mon Sep 17 00:00:00 2001 From: johnswanson3 Date: Wed, 15 Jun 2016 06:54:39 +0800 Subject: [PATCH 22/46] Create PCP.py --- PCP.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 PCP.py diff --git a/PCP.py b/PCP.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/PCP.py @@ -0,0 +1 @@ + From 2975f105391330628b17a5c554b7e8789462ef77 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 19:05:34 -0400 Subject: [PATCH 23/46] File Creation --- .idea/vcs.xml | 6 ++ test.py | 256 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 262 insertions(+) create mode 100644 .idea/vcs.xml create mode 100644 test.py diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/test.py b/test.py new file mode 100644 index 0000000..b31cab1 --- /dev/null +++ b/test.py @@ -0,0 +1,256 @@ +""" +*************************************************************************** +filename: mixtape_jump.py +description: A side scrolling game where the player (mixtape) must navigate through rappers and achieve a high score! +Author: Wei.K, Miyata.Y, Han.J +Created On: 06/13/2016 +*************************************************************************** +""" +import kivy +kivy.require('1.7.2') +from kivy.app import App +from kivy.uix.widget import Widget +from kivy.uix.label import Label +from kivy.uix.button import Button +from kivy.core.window import Window +from kivy.properties import NumericProperty +from kivy.clock import Clock +from kivy.graphics import Rectangle, Color, Canvas +from random import * + +#Background color (Black) +Window.clearcolor = (0,0,0,1.) + +class WidgetDrawer(Widget): +#This widget is used to draw all of the objects on the screen +#This initializes widget movement, size, positioning +#objects of this class must be initiated with an image string +#with asterisks, Kwargs allow to pass all arguments without needing its parameters + def __init__(self, imageStr, **kwargs): + super(WidgetDrawer, self).__init__(**kwargs) #this is part of the **kwargs notation +#if you haven't seen with before, here's a link http://effbot.org/zone/python-with-statement.html + with self.canvas: +#this line creates a rectangle with the image drawn on top + self.size = (Window.width*.005*25,Window.height*.005*25) + self.rect_bg= Rectangle(source=imageStr,pos=self.pos,size = self.size) +#this line calls the update_graphics_pos function every time the position variable is modified + self.bind(pos=self.update_graphics_pos) + self.x = self.center_x + self.y = self.center_y +#center the widget + self.pos = (self.x,self.y) +#center the rectangle on the widget + self.rect_bg.pos = self.pos + + def update_graphics_pos(self, instance, value): +#if the widgets position moves, the rectangle that contains the image is also moved + self.rect_bg.pos = value +#use this function to change widget size + def setSize(self,width, height): + self.size = (width, height) + def setPos(self,xpos,ypos): + self.x = xpos + self.y = ypos + + +class rapper(WidgetDrawer): + #rapper class. The flappy mixtape will dodge these + velocity_x = NumericProperty(0) #initialize velocity_x and velocity_y + velocity_y = NumericProperty(0) #declaring variables is not necessary in python + #update the position using the velocity defined here. every time move is called we change the position by velocity_x + def move(self): + self.x = self.x + self.velocity_x + self.y = self.y + self.velocity_y + def update(self): +#the update function moves the astreoid. Other things could happen here as well (speed changes for example) + self.move() + + +class mixtape(WidgetDrawer): + #mixtape class. This is for the main mixtape object. + #velocity of mixtape on x/y axis + def __init__(self, imageStr) : + WidgetDrawer.__init__(self, imageStr) + self.impulse = 3 #this variable will be used to move the mixtape up + self.grav = -0.1 #this variable will be used to pull the mixtape down + + self.velocity_x = 0 #we wont actually use x movement + self.velocity_y = 0 + + self.setSize(50, 30) + + def setSize (self, width, height): + WidgetDrawer.setSize(self, width, height) + + def move(self): + self.x = self.x + self.velocity_x + self.y = self.y + self.velocity_y + + #don't let the mixtape go too far + if self.y > Window.height*0.95: #don't let the mixtape go up too high + self.impulse = -3 + + def determineVelocity(self): + #move the mixtape up and down + #we need to take into account our acceleration + #also want to look at gravity + self.grav = self.grav*1.05 #the gravitational velocity should increase + #set a grav limit + if self.grav < -4: #set a maximum falling down speed (terminal velocity) + self.grav = -4 + #the mixtape has a propety called self.impulse which is updated + #whenever the player touches, pushing the mixtape up + #use this impulse to determine the mixtape velocity + #also decrease the magnitude of the impulse each time its used + + self.velocity_y = self.impulse + self.grav + self.impulse = 0.95*self.impulse #make the upward velocity decay + + def update(self): + self.determineVelocity() #first figure out the new velocity + self.move() #now move the mixtape + + +class MyButton(Button): + #class used to get uniform button styles + def __init__(self, **kwargs): + super(MyButton, self).__init__(**kwargs) + #all we're doing is setting the font size. more can be done later + self.font_size = Window.width*0.018 + + +class GUI(Widget): + #this is the main widget that contains the game. + rapperList =[] #use this to keep track of rappers + rapperScore = NumericProperty(0) + minProb = 1780 #this variable used in spawning rappers + def __init__(self, **kwargs): + super(GUI, self).__init__(**kwargs) + self.score = Label(text = "0") + self.score.y = Window.height*0.8 + self.score.x = Window.width*0.2 + self.rapperScore = 0 + l = Label(text='Mixtape Jump') #give the game a title + l.x = Window.width/2 - l.width/2 + l.y = Window.height*0.8 + self.add_widget(l) #add the label to the screen + + #now we create a mixtape object + #notice how we specify the mixtape image + self.mixtape = mixtape(imageStr = 'C:\Users\Koven\desktop\photoshopped\mmixtape.png') + self.mixtape.x = Window.width/4 + self.mixtape.y = Window.height/2 + self.add_widget(self.mixtape) + + + def check_score(self,obj): + #update credits + self.score.text = str(self.rapperScore) + + self.bind(rapperScore = check_score) + self.add_widget(self.score) + + + def addrapper(self): + #add an rapper to the screen + #self.rapper + imageNumber = randint(1,7) + imageStr = ('C:\Users\Koven\desktop\photoshopped\image'+str(imageNumber)+'.png') + tmprapper = rapper(imageStr) + tmprapper.x = Window.width*0.99 + #randomize y position + ypos = randint(2,25) + ypos = ypos*Window.height*.0625 + tmprapper.y = ypos + tmprapper.velocity_y = 0 + vel = 10 + tmprapper.velocity_x = -0.1*vel + self.rapperList.append(tmprapper) + self.add_widget(tmprapper) + + #handle input events + #kivy has a great event handler. the on_touch_down function is already recognized + #and doesn't need t obe setup. Every time the screen is touched, the on_touch_down function is called + def on_touch_down(self, touch): + self.mixtape.impulse = 3 #give the mixtape an impulse + self.mixtape.grav = -0.1 #reset the gravitational velocity + + def gameOver(self): #this function is called when the game ends + #add a restart button + restartButton = MyButton(text='Press to Restart, your score was ' + str(self.rapperScore)) + def restart_button(obj): + #this function will be called whenever the reset button is pushed + print 'restart button pushed' + #reset game + for k in self.rapperList: + self.remove_widget(k) + self.mixtape.xpos = Window.width*0.25 + self.mixtape.ypos = Window.height*0.5 + self.minProb = 1780 + self.rapperList = [] + + self.parent.remove_widget(restartButton) + #stop the game clock in case it hasn't already been stopped + Clock.unschedule(self.update) + #start the game clock + Clock.schedule_interval(self.update, 1.0/60.0) + restartButton.size = (Window.width*.3,Window.width*.1) + restartButton.pos = Window.width*0.5-restartButton.width/2, Window.height*0.5 + #bind the button using the built-in on_release event + #whenever the button is released, the restart_button function is called + restartButton.bind(on_release=restart_button) + + #*** It's important that the parent get the button so you can click on it + #otherwise you can't click through the main game's canvas + self.parent.add_widget(restartButton) + + + def update(self,dt): + #This update function is the main update function for the game + #All of the game logic has its origin here + #events are setup here as well + #update game objects + #update mixtape + self.mixtape.update() + #update rappers + #randomly add an rapper + tmpCount = randint(1,1800) + print self.minProb + if tmpCount > self.minProb: + self.addrapper() + self.minProb = self.minProb - 0.10 + if self.minProb <= 1750: + self.minProb = self.minProb + 0.1 + if self.mixtape.y < Window.height * 0.001: + self.mixtape.impulse = 10 + for k in self.rapperList: + #check for collision with mixtape + if k.collide_widget(self.mixtape): + print 'death' + #game over routine + self.gameOver() + Clock.unschedule(self.update) + self.rapperScore = 0 + #add reset button + if k.x < -100: + self.remove_widget(k) + self.rapperScore += 1 + tmpRapperList = self.rapperList + tmpRapperList[:] = [x for x in tmpRapperList if (x.x > - 100)] + self.RapperList = tmpRapperList + k.update() + +class ClientApp(App): + + def build(self): + #this is where the root widget goes + #should be a canvas + parent = Widget() #this is an empty holder for buttons, etc + app = GUI() + #Start the game clock (runs update function once every (1/60) seconds + Clock.schedule_interval(app.update, 1.0/60.0) + parent.add_widget(app) #use this hierarchy to make it easy to deal w/buttons + return parent + +if __name__ == '__main__' : + ClientApp().run() \ No newline at end of file From 40be64439732c5e4bc113e216f39d54650347f18 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 19:06:18 -0400 Subject: [PATCH 24/46] Delete test.py --- test.py | 256 -------------------------------------------------------- 1 file changed, 256 deletions(-) delete mode 100644 test.py diff --git a/test.py b/test.py deleted file mode 100644 index b31cab1..0000000 --- a/test.py +++ /dev/null @@ -1,256 +0,0 @@ -""" -*************************************************************************** -filename: mixtape_jump.py -description: A side scrolling game where the player (mixtape) must navigate through rappers and achieve a high score! -Author: Wei.K, Miyata.Y, Han.J -Created On: 06/13/2016 -*************************************************************************** -""" -import kivy -kivy.require('1.7.2') -from kivy.app import App -from kivy.uix.widget import Widget -from kivy.uix.label import Label -from kivy.uix.button import Button -from kivy.core.window import Window -from kivy.properties import NumericProperty -from kivy.clock import Clock -from kivy.graphics import Rectangle, Color, Canvas -from random import * - -#Background color (Black) -Window.clearcolor = (0,0,0,1.) - -class WidgetDrawer(Widget): -#This widget is used to draw all of the objects on the screen -#This initializes widget movement, size, positioning -#objects of this class must be initiated with an image string -#with asterisks, Kwargs allow to pass all arguments without needing its parameters - def __init__(self, imageStr, **kwargs): - super(WidgetDrawer, self).__init__(**kwargs) #this is part of the **kwargs notation -#if you haven't seen with before, here's a link http://effbot.org/zone/python-with-statement.html - with self.canvas: -#this line creates a rectangle with the image drawn on top - self.size = (Window.width*.005*25,Window.height*.005*25) - self.rect_bg= Rectangle(source=imageStr,pos=self.pos,size = self.size) -#this line calls the update_graphics_pos function every time the position variable is modified - self.bind(pos=self.update_graphics_pos) - self.x = self.center_x - self.y = self.center_y -#center the widget - self.pos = (self.x,self.y) -#center the rectangle on the widget - self.rect_bg.pos = self.pos - - def update_graphics_pos(self, instance, value): -#if the widgets position moves, the rectangle that contains the image is also moved - self.rect_bg.pos = value -#use this function to change widget size - def setSize(self,width, height): - self.size = (width, height) - def setPos(self,xpos,ypos): - self.x = xpos - self.y = ypos - - -class rapper(WidgetDrawer): - #rapper class. The flappy mixtape will dodge these - velocity_x = NumericProperty(0) #initialize velocity_x and velocity_y - velocity_y = NumericProperty(0) #declaring variables is not necessary in python - #update the position using the velocity defined here. every time move is called we change the position by velocity_x - def move(self): - self.x = self.x + self.velocity_x - self.y = self.y + self.velocity_y - def update(self): -#the update function moves the astreoid. Other things could happen here as well (speed changes for example) - self.move() - - -class mixtape(WidgetDrawer): - #mixtape class. This is for the main mixtape object. - #velocity of mixtape on x/y axis - def __init__(self, imageStr) : - WidgetDrawer.__init__(self, imageStr) - self.impulse = 3 #this variable will be used to move the mixtape up - self.grav = -0.1 #this variable will be used to pull the mixtape down - - self.velocity_x = 0 #we wont actually use x movement - self.velocity_y = 0 - - self.setSize(50, 30) - - def setSize (self, width, height): - WidgetDrawer.setSize(self, width, height) - - def move(self): - self.x = self.x + self.velocity_x - self.y = self.y + self.velocity_y - - #don't let the mixtape go too far - if self.y > Window.height*0.95: #don't let the mixtape go up too high - self.impulse = -3 - - def determineVelocity(self): - #move the mixtape up and down - #we need to take into account our acceleration - #also want to look at gravity - self.grav = self.grav*1.05 #the gravitational velocity should increase - #set a grav limit - if self.grav < -4: #set a maximum falling down speed (terminal velocity) - self.grav = -4 - #the mixtape has a propety called self.impulse which is updated - #whenever the player touches, pushing the mixtape up - #use this impulse to determine the mixtape velocity - #also decrease the magnitude of the impulse each time its used - - self.velocity_y = self.impulse + self.grav - self.impulse = 0.95*self.impulse #make the upward velocity decay - - def update(self): - self.determineVelocity() #first figure out the new velocity - self.move() #now move the mixtape - - -class MyButton(Button): - #class used to get uniform button styles - def __init__(self, **kwargs): - super(MyButton, self).__init__(**kwargs) - #all we're doing is setting the font size. more can be done later - self.font_size = Window.width*0.018 - - -class GUI(Widget): - #this is the main widget that contains the game. - rapperList =[] #use this to keep track of rappers - rapperScore = NumericProperty(0) - minProb = 1780 #this variable used in spawning rappers - def __init__(self, **kwargs): - super(GUI, self).__init__(**kwargs) - self.score = Label(text = "0") - self.score.y = Window.height*0.8 - self.score.x = Window.width*0.2 - self.rapperScore = 0 - l = Label(text='Mixtape Jump') #give the game a title - l.x = Window.width/2 - l.width/2 - l.y = Window.height*0.8 - self.add_widget(l) #add the label to the screen - - #now we create a mixtape object - #notice how we specify the mixtape image - self.mixtape = mixtape(imageStr = 'C:\Users\Koven\desktop\photoshopped\mmixtape.png') - self.mixtape.x = Window.width/4 - self.mixtape.y = Window.height/2 - self.add_widget(self.mixtape) - - - def check_score(self,obj): - #update credits - self.score.text = str(self.rapperScore) - - self.bind(rapperScore = check_score) - self.add_widget(self.score) - - - def addrapper(self): - #add an rapper to the screen - #self.rapper - imageNumber = randint(1,7) - imageStr = ('C:\Users\Koven\desktop\photoshopped\image'+str(imageNumber)+'.png') - tmprapper = rapper(imageStr) - tmprapper.x = Window.width*0.99 - #randomize y position - ypos = randint(2,25) - ypos = ypos*Window.height*.0625 - tmprapper.y = ypos - tmprapper.velocity_y = 0 - vel = 10 - tmprapper.velocity_x = -0.1*vel - self.rapperList.append(tmprapper) - self.add_widget(tmprapper) - - #handle input events - #kivy has a great event handler. the on_touch_down function is already recognized - #and doesn't need t obe setup. Every time the screen is touched, the on_touch_down function is called - def on_touch_down(self, touch): - self.mixtape.impulse = 3 #give the mixtape an impulse - self.mixtape.grav = -0.1 #reset the gravitational velocity - - def gameOver(self): #this function is called when the game ends - #add a restart button - restartButton = MyButton(text='Press to Restart, your score was ' + str(self.rapperScore)) - def restart_button(obj): - #this function will be called whenever the reset button is pushed - print 'restart button pushed' - #reset game - for k in self.rapperList: - self.remove_widget(k) - self.mixtape.xpos = Window.width*0.25 - self.mixtape.ypos = Window.height*0.5 - self.minProb = 1780 - self.rapperList = [] - - self.parent.remove_widget(restartButton) - #stop the game clock in case it hasn't already been stopped - Clock.unschedule(self.update) - #start the game clock - Clock.schedule_interval(self.update, 1.0/60.0) - restartButton.size = (Window.width*.3,Window.width*.1) - restartButton.pos = Window.width*0.5-restartButton.width/2, Window.height*0.5 - #bind the button using the built-in on_release event - #whenever the button is released, the restart_button function is called - restartButton.bind(on_release=restart_button) - - #*** It's important that the parent get the button so you can click on it - #otherwise you can't click through the main game's canvas - self.parent.add_widget(restartButton) - - - def update(self,dt): - #This update function is the main update function for the game - #All of the game logic has its origin here - #events are setup here as well - #update game objects - #update mixtape - self.mixtape.update() - #update rappers - #randomly add an rapper - tmpCount = randint(1,1800) - print self.minProb - if tmpCount > self.minProb: - self.addrapper() - self.minProb = self.minProb - 0.10 - if self.minProb <= 1750: - self.minProb = self.minProb + 0.1 - if self.mixtape.y < Window.height * 0.001: - self.mixtape.impulse = 10 - for k in self.rapperList: - #check for collision with mixtape - if k.collide_widget(self.mixtape): - print 'death' - #game over routine - self.gameOver() - Clock.unschedule(self.update) - self.rapperScore = 0 - #add reset button - if k.x < -100: - self.remove_widget(k) - self.rapperScore += 1 - tmpRapperList = self.rapperList - tmpRapperList[:] = [x for x in tmpRapperList if (x.x > - 100)] - self.RapperList = tmpRapperList - k.update() - -class ClientApp(App): - - def build(self): - #this is where the root widget goes - #should be a canvas - parent = Widget() #this is an empty holder for buttons, etc - app = GUI() - #Start the game clock (runs update function once every (1/60) seconds - Clock.schedule_interval(app.update, 1.0/60.0) - parent.add_widget(app) #use this hierarchy to make it easy to deal w/buttons - return parent - -if __name__ == '__main__' : - ClientApp().run() \ No newline at end of file From ec2a50678e2292a81662cfd565b155f2a4a05bcf Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 19:08:31 -0400 Subject: [PATCH 25/46] Delete PCP.py --- PCP.py | 1 - 1 file changed, 1 deletion(-) delete mode 100644 PCP.py diff --git a/PCP.py b/PCP.py deleted file mode 100644 index 8b13789..0000000 --- a/PCP.py +++ /dev/null @@ -1 +0,0 @@ - From 84dd262c7d729332ce47d450be02bef8422260a0 Mon Sep 17 00:00:00 2001 From: John Python Date: Wed, 15 Jun 2016 08:17:19 +0800 Subject: [PATCH 26/46] test2 --- mixtape_jump.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mixtape_jump.py b/mixtape_jump.py index b2d5ce0..ad66493 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -1 +1 @@ -"testing" \ No newline at end of file +"Imma send you some text" \ No newline at end of file From 726f2db5a5ffbcb2e7c67b81e6cbf2e955cb0821 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 20:17:26 -0400 Subject: [PATCH 27/46] OKOKOKOKO --- .idea/vcs.xml | 6 ++++++ mixtape_jump.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/mixtape_jump.py b/mixtape_jump.py index b2d5ce0..5ae18d7 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -1 +1 @@ -"testing" \ No newline at end of file +"I HOPE THIS WORKS I WANT IT TO WORk" \ No newline at end of file From 10537e887eabe412ba1c337e2c86f2f7e15cf3da Mon Sep 17 00:00:00 2001 From: YutaroM Date: Tue, 14 Jun 2016 20:26:56 -0400 Subject: [PATCH 28/46] Test1 --- mixtape_jump.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mixtape_jump.py b/mixtape_jump.py index ad66493..594d217 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -1 +1,2 @@ -"Imma send you some text" \ No newline at end of file +"Imma send you some text" +#John is a goon \ No newline at end of file From 1cc86df94bc4c87e786fad8f2b8b4353bd22f983 Mon Sep 17 00:00:00 2001 From: YutaroM Date: Tue, 14 Jun 2016 20:40:41 -0400 Subject: [PATCH 29/46] class widgetdrawer --- mixtape_jump.py | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/mixtape_jump.py b/mixtape_jump.py index 594d217..06620d6 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -1,2 +1,38 @@ -"Imma send you some text" -#John is a goon \ No newline at end of file +import kivy +kivy.require('1.7.2') +from kivy.app import App +from kivy.uix.widget import Widget +from kivy.uix.label import Label +from kivy.uix.button import Button +from kivy.core.window import Window +from kivy.properties import NumericProperty +from kivy.clock import Clock +from kivy.graphics import Rectangle, Color, Canvas +from random import * + +class WidgetDrawer(Widget): + + def __init__(self, imageStr, **kwargs): + super(WidgetDrawer, self).__init__(**kwargs) + with self.canvas: + + self.size = (Window.width*.005*25,Window.height*.005*25) + self.rect_bg= Rectangle(source=imageStr,pos=self.pos,size = self.size) + + self.bind(pos=self.update_graphics_pos) + self.x = self.center_x + self.y = self.center_y + + self.pos = (self.x,self.y) + + self.rect_bg.pos = self.pos + + def update_graphics_pos(self, instance, value): + + self.rect_bg.pos = value + + def setSize(self,width, height): + self.size = (width, height) + def setPos(self,xpos,ypos): + self.x = xpos + self.y = ypos \ No newline at end of file From c086404acada8f78ef3c00932c46945e2169b8c8 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 20:41:00 -0400 Subject: [PATCH 30/46] Added imports --- mixtape_jump.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mixtape_jump.py b/mixtape_jump.py index 5ae18d7..360089f 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -1 +1,11 @@ -"I HOPE THIS WORKS I WANT IT TO WORk" \ No newline at end of file +import kivy +kivy.require('1.7.2') +from kivy.app import App +from kivy.uix.widget import Widget +from kivy.uix.label import Label +from kivy.uix.button import Button +from kivy.core.window import Window +from kivy.properties import NumericProperty +from kivy.clock import Clock +from kivy.graphics import Rectangle, Color, Canvas +from random import * From 71d3467766334c1275a048ab0de9e743aee81adf Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 20:47:35 -0400 Subject: [PATCH 31/46] Merge remote-tracking branch 'remotes/origin/master' into Koven-Wei # Conflicts: # mixtape_jump.py --- mixtape_jump.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mixtape_jump.py b/mixtape_jump.py index 6c9347b..41e7a1b 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -1,3 +1,13 @@ -"I HOPE THIS WORKS I WANT IT TO WORk" -"Imma send you some text" -#John is a goon +import kivy +kivy.require('1.7.2') +from kivy.app import App +from kivy.uix.widget import Widget +from kivy.uix.label import Label +from kivy.uix.button import Button +from kivy.core.window import Window +from kivy.properties import NumericProperty +from kivy.clock import Clock +from kivy.graphics import Rectangle, Color, Canvas +from random import * + + From 327afedd8bbc9ab6c1c3e072eefc24ce7bf8a6d8 Mon Sep 17 00:00:00 2001 From: YutaroM Date: Tue, 14 Jun 2016 20:53:05 -0400 Subject: [PATCH 32/46] Created widgetdrawer class, initialized, determined size of widget --- mixtape_jump.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mixtape_jump.py b/mixtape_jump.py index 06620d6..3bfad8a 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -35,4 +35,5 @@ def setSize(self,width, height): self.size = (width, height) def setPos(self,xpos,ypos): self.x = xpos - self.y = ypos \ No newline at end of file + self.y = ypos + From cfd37d16e7f9ec436fd3368cbcf439aeb443185c Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 20:54:03 -0400 Subject: [PATCH 33/46] Created class GUI(widget) initialized the rapper amount in list initialized the score initialized the probability of spawn Given __init__ created score label created title specified location of image player --- mixtape_jump.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/mixtape_jump.py b/mixtape_jump.py index 696155a..68fa0be 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -10,6 +10,21 @@ from kivy.graphics import Rectangle, Color, Canvas from random import * -"I HOPE THIS WORKS I WANT IT TO WORk" -"Imma send you some text" -#John is a goon +class GUI(Widget): + rapperList =[] + rapperScore = NumericProperty(0) + minProb = 1780 + def __init__(self, **kwargs): + super(GUI, self).__init__(**kwargs) + self.score = Label(text = "0") + self.score.y = Window.height*0.8 + self.score.x = Window.width*0.2 + self.rapperScore = 0 + l = Label(text='Mixtape Jump') + l.x = Window.width/2 - l.width/2 + l.y = Window.height*0.8 + self.add_widget(l) + self.mixtape = mixtape(imageStr = 'C:\Users\Koven\desktop\photoshopped\mmixtape.png') + self.mixtape.x = Window.width/4 + self.mixtape.y = Window.height/2 + self.add_widget(self.mixtape) From 6904c1a2608f04acb9ae6435e586717c361bf171 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 21:16:55 -0400 Subject: [PATCH 34/46] Created check score function initializes text that follows string rapperScore allows function to be called when rapperScore changes adds the widget on screen --- mixtape_jump.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mixtape_jump.py b/mixtape_jump.py index 968ad48..0479793 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -28,6 +28,11 @@ def __init__(self, **kwargs): self.mixtape.x = Window.width/4 self.mixtape.y = Window.height/2 self.add_widget(self.mixtape) + def check_score(self,obj): + self.score.text = str(self.rapperScore) + + self.bind(rapperScore = check_score) + self.add_widget(self.score) From 538cb9be8c604d23a71430ee839207f408b23e7c Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 21:22:36 -0400 Subject: [PATCH 35/46] acidentally added yutaro's --- mixtape_jump.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/mixtape_jump.py b/mixtape_jump.py index bae3bb3..d91425b 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -35,31 +35,6 @@ def check_score(self,obj): self.add_widget(self.score) -class WidgetDrawer(Widget): - def __init__(self, imageStr, **kwargs): - super(WidgetDrawer, self).__init__(**kwargs) - with self.canvas: - - self.size = (Window.width*.005*25,Window.height*.005*25) - self.rect_bg= Rectangle(source=imageStr,pos=self.pos,size = self.size) - - self.bind(pos=self.update_graphics_pos) - self.x = self.center_x - self.y = self.center_y - - self.pos = (self.x,self.y) - - self.rect_bg.pos = self.pos - - def update_graphics_pos(self, instance, value): - - self.rect_bg.pos = value - - def setSize(self,width, height): - self.size = (width, height) - def setPos(self,xpos,ypos): - self.x = xpos - self.y = ypos From e9a45e5532f6932463ad3fe07752dde08c812f29 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 21:23:31 -0400 Subject: [PATCH 36/46] fixed self placement --- mixtape_jump.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mixtape_jump.py b/mixtape_jump.py index d91425b..8ca0190 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -30,9 +30,8 @@ def __init__(self, **kwargs): self.add_widget(self.mixtape) def check_score(self,obj): self.score.text = str(self.rapperScore) - - self.bind(rapperScore = check_score) - self.add_widget(self.score) + self.bind(rapperScore = check_score) + self.add_widget(self.score) From df048f1c61718af10afa1b48515816073b1e107b Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Tue, 14 Jun 2016 21:26:59 -0400 Subject: [PATCH 37/46] Created next function add rapper and fixed def check_score placement --- mixtape_jump.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/mixtape_jump.py b/mixtape_jump.py index 8ca0190..4710c55 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -28,10 +28,26 @@ def __init__(self, **kwargs): self.mixtape.x = Window.width/4 self.mixtape.y = Window.height/2 self.add_widget(self.mixtape) - def check_score(self,obj): + def check_score(self,obj): self.score.text = str(self.rapperScore) - self.bind(rapperScore = check_score) - self.add_widget(self.score) + self.bind(rapperScore = check_score) + self.add_widget(self.score) + def addrapper(self): + #add an rapper to the screen + #self.rapper + imageNumber = randint(1,7) + imageStr = ('C:\Users\Koven\desktop\photoshopped\image'+str(imageNumber)+'.png') + tmprapper = rapper(imageStr) + tmprapper.x = Window.width*0.99 + #randomize y position + ypos = randint(2,25) + ypos = ypos*Window.height*.0625 + tmprapper.y = ypos + tmprapper.velocity_y = 0 + vel = 10 + tmprapper.velocity_x = -0.1*vel + self.rapperList.append(tmprapper) + self.add_widget(tmprapper) From e382b7cd58c6235faffe3976f669f7724f13522e Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Wed, 15 Jun 2016 00:26:54 -0400 Subject: [PATCH 38/46] Created function addrapper(self) Created multiple enemy objects Created a positions and movements of the rappers randomized positions to create difficulty only x movements added a new list that appends solely for scores --- mixtape_jump.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mixtape_jump.py b/mixtape_jump.py index 4710c55..d0617b4 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -28,13 +28,20 @@ def __init__(self, **kwargs): self.mixtape.x = Window.width/4 self.mixtape.y = Window.height/2 self.add_widget(self.mixtape) + def check_score(self,obj): self.score.text = str(self.rapperScore) self.bind(rapperScore = check_score) self.add_widget(self.score) + def addrapper(self): + """ + Program to initialize the opposing objects and the multiple rapper heads which includes its randomized placement + and the velocity which it moves at + :return: + """ #add an rapper to the screen - #self.rapper + #initialize its image imageNumber = randint(1,7) imageStr = ('C:\Users\Koven\desktop\photoshopped\image'+str(imageNumber)+'.png') tmprapper = rapper(imageStr) @@ -42,10 +49,12 @@ def addrapper(self): #randomize y position ypos = randint(2,25) ypos = ypos*Window.height*.0625 + #moves only on the x-axis tmprapper.y = ypos tmprapper.velocity_y = 0 vel = 10 tmprapper.velocity_x = -0.1*vel + #adds list to another rapper list which helps append score self.rapperList.append(tmprapper) self.add_widget(tmprapper) @@ -53,3 +62,4 @@ def addrapper(self): + From edffe3fedcbadebb3aa2dc5f7021dafadf3a4c93 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Wed, 15 Jun 2016 00:41:59 -0400 Subject: [PATCH 39/46] Created function on_touch_down(self,touch) screen function when pressed (kivy) triggers player to move up or fall down --- mixtape_jump.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mixtape_jump.py b/mixtape_jump.py index d0617b4..ce9aed8 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -57,6 +57,17 @@ def addrapper(self): #adds list to another rapper list which helps append score self.rapperList.append(tmprapper) self.add_widget(tmprapper) + #handle input events + def on_touch_down(self, touch): + """ + Program to move the mixtape up according to when the screen is pressed + :param touch: none (when it is pressed down (responsive to touch events)) + :return: + """ + #moves the mixtape up + self.mixtape.impulse = 3 + #Gravitational velocity to help move down + self.mixtape.grav = -0.1 From 862ad6780c4dfbc0b4264be053e5da7bda5f2311 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Wed, 15 Jun 2016 01:24:14 -0400 Subject: [PATCH 40/46] Added a few docstrings created function gameOver(self) created function restart_button(obj) created initalizaiton of restart button changes update of clock created the touch release of button --- mixtape_jump.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/mixtape_jump.py b/mixtape_jump.py index ce9aed8..31c022e 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -69,6 +69,40 @@ def on_touch_down(self, touch): #Gravitational velocity to help move down self.mixtape.grav = -0.1 + def gameOver(self): + """ + Program to initiate when the game is over from collision as well as the initialization of restart + :return: + """ + # this function is called when the game ends + #add a restart button + restartButton = MyButton(text='Press to Restart, your score was ' + str(self.rapperScore)) + def restart_button(obj): + #this function will be called whenever the reset button is pushed + print 'restart button pushed' + #reset game + for k in self.rapperList: + self.remove_widget(k) + self.mixtape.xpos = Window.width*0.25 + self.mixtape.ypos = Window.height*0.5 + self.minProb = 1780 + self.rapperList = [] + + self.parent.remove_widget(restartButton) + #stop the game clock in case it hasn't already been stopped + Clock.unschedule(self.update) + #start the game clock + Clock.schedule_interval(self.update, 1.0/60.0) + restartButton.size = (Window.width*.3,Window.width*.1) + restartButton.pos = Window.width*0.5-restartButton.width/2, Window.height*0.5 + #bind the button using the built-in on_release event + #whenever the button is released, the restart_button function is called + restartButton.bind(on_release=restart_button) + + #It's important that the parent gets the button so you can click on it + #otherwise you can't click through the main game's canvas + self.parent.add_widget(restartButton) + From a9aa1fc3d4ff91744ccee662ee8726b72ef34180 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Wed, 15 Jun 2016 01:24:54 -0400 Subject: [PATCH 41/46] Added a few docstrings created function gameOver(self) created function restart_button(obj) created initalizaiton of restart button changes update of clock created the touch release of button --- mixtape_jump.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/mixtape_jump.py b/mixtape_jump.py index d0617b4..c629e2d 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -58,6 +58,40 @@ def addrapper(self): self.rapperList.append(tmprapper) self.add_widget(tmprapper) + def gameOver(self): + """ + Program to initiate when the game is over from collision as well as the initialization of restart + :return: + """ + # this function is called when the game ends + #add a restart button + restartButton = MyButton(text='Press to Restart, your score was ' + str(self.rapperScore)) + def restart_button(obj): + #this function will be called whenever the reset button is pushed + print 'restart button pushed' + #reset game + for k in self.rapperList: + self.remove_widget(k) + self.mixtape.xpos = Window.width*0.25 + self.mixtape.ypos = Window.height*0.5 + self.minProb = 1780 + self.rapperList = [] + + self.parent.remove_widget(restartButton) + #stop the game clock in case it hasn't already been stopped + Clock.unschedule(self.update) + #start the game clock + Clock.schedule_interval(self.update, 1.0/60.0) + restartButton.size = (Window.width*.3,Window.width*.1) + restartButton.pos = Window.width*0.5-restartButton.width/2, Window.height*0.5 + #bind the button using the built-in on_release event + #whenever the button is released, the restart_button function is called + restartButton.bind(on_release=restart_button) + + #It's important that the parent gets the button so you can click on it + #otherwise you can't click through the main game's canvas + self.parent.add_widget(restartButton) + From 16b3a0b72abce904ee117c3acbe1cf4080b86ac4 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Wed, 15 Jun 2016 15:56:40 -0400 Subject: [PATCH 42/46] Added function update(self,dt) created parameter to refer to time created random integer to spawn rappers created difficulty scaling as time passes by with minProb created collision statement scheduling clock times removing rappers from temporary list as well as append score to rapperScore call k.update() 60 times /second --- mixtape_jump.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/mixtape_jump.py b/mixtape_jump.py index 8dd3095..962eb98 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -137,6 +137,47 @@ def restart_button(obj): #otherwise you can't click through the main game's canvas self.parent.add_widget(restartButton) + def update(self,dt): + """ + Program to update when the add to score as well as when to spawn a rapper, end the game + :param dt: none (clock object (time elapsed)) + :return: + """ + #This update function is the main update function for the game + #events are setup here as well + #update game objects + #update mixtape + self.mixtape.update() + #update rappers + #randomly add an rapper + tmpCount = randint(1,1800) + print self.minProb + #overtime difficulty increase + if tmpCount > self.minProb: + self.addrapper() + self.minProb = self.minProb - 0.10 + #peak difficulty + if self.minProb <= 1750: + self.minProb = self.minProb + 0.1 + if self.mixtape.y < Window.height * 0.001: + self.mixtape.impulse = 10 + for k in self.rapperList: + #check for collision with mixtape + if k.collide_widget(self.mixtape): + print 'death' + #game over routine + self.gameOver() + Clock.unschedule(self.update) + self.rapperScore = 0 + #when rappers past the left screen + if k.x < -100: + self.remove_widget(k) + self.rapperScore += 1 + tmpRapperList = self.rapperList + tmpRapperList[:] = [x for x in tmpRapperList if (x.x > - 100)] + self.RapperList = tmpRapperList + k.update() + From 10896df5f7bd8dfe2cc5fc659f22647e45a71ab7 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Wed, 15 Jun 2016 15:57:08 -0400 Subject: [PATCH 43/46] Added function update(self,dt) created parameter to refer to time created random integer to spawn rappers created difficulty scaling as time passes by with minProb created collision statement scheduling clock times removing rappers from temporary list as well as append score to rapperScore call k.update() 60 times /second --- mixtape_jump.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/mixtape_jump.py b/mixtape_jump.py index c629e2d..b0ee302 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -92,6 +92,47 @@ def restart_button(obj): #otherwise you can't click through the main game's canvas self.parent.add_widget(restartButton) + def update(self,dt): + """ + Program to update when the add to score as well as when to spawn a rapper, end the game + :param dt: none (clock object (time elapsed)) + :return: + """ + #This update function is the main update function for the game + #events are setup here as well + #update game objects + #update mixtape + self.mixtape.update() + #update rappers + #randomly add an rapper + tmpCount = randint(1,1800) + print self.minProb + #overtime difficulty increase + if tmpCount > self.minProb: + self.addrapper() + self.minProb = self.minProb - 0.10 + #peak difficulty + if self.minProb <= 1750: + self.minProb = self.minProb + 0.1 + if self.mixtape.y < Window.height * 0.001: + self.mixtape.impulse = 10 + for k in self.rapperList: + #check for collision with mixtape + if k.collide_widget(self.mixtape): + print 'death' + #game over routine + self.gameOver() + Clock.unschedule(self.update) + self.rapperScore = 0 + #when rappers past the left screen + if k.x < -100: + self.remove_widget(k) + self.rapperScore += 1 + tmpRapperList = self.rapperList + tmpRapperList[:] = [x for x in tmpRapperList if (x.x > - 100)] + self.RapperList = tmpRapperList + k.update() + From 769c14958cddd82e7c81c7a76c3681cfeffdc350 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Wed, 15 Jun 2016 17:00:11 -0400 Subject: [PATCH 44/46] Created class ClientApp(App) Initializes the game created holder for buttons and initialization initialize app linked to GUI created clock schedule add app as a widget --- mixtape_jump.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/mixtape_jump.py b/mixtape_jump.py index 962eb98..88e663e 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -179,6 +179,31 @@ def update(self,dt): k.update() +class ClientApp(App): + """ + An Client App Object + """ + def build(self): + """ + Program to initialize the buttons and start the game and game clock + :return: none (return the GUI Class) + """ + #widget initializations and insertion + #used to initialize buttons + parent = Widget() + app = GUI() + #Start the game clock (runs update function once every (1/60) seconds) + Clock.schedule_interval(app.update, 1.0/60.0) + parent.add_widget(app) + return parent + +if __name__ == '__main__' : + ClientApp().run() + + + + + From afdb25b522be46ce57bacc73185370cec2967783 Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Wed, 15 Jun 2016 17:03:28 -0400 Subject: [PATCH 45/46] Created class ClientApp(App) Initializes the game created holder for buttons and initialization initialize app linked to GUI created clock schedule add app as a widget --- mixtape_jump.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mixtape_jump.py b/mixtape_jump.py index 88e663e..fb1ed4b 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -200,7 +200,7 @@ def build(self): if __name__ == '__main__' : ClientApp().run() - + From 024df640f66a4c33711434a55b276448ab2a07ed Mon Sep 17 00:00:00 2001 From: Kovenwei Date: Wed, 15 Jun 2016 17:11:54 -0400 Subject: [PATCH 46/46] fixing merging error --- mixtape_jump.py | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/mixtape_jump.py b/mixtape_jump.py index b977d94..da580d6 100644 --- a/mixtape_jump.py +++ b/mixtape_jump.py @@ -203,46 +203,7 @@ def build(self): - def update(self,dt): - """ - Program to update when the add to score as well as when to spawn a rapper, end the game - :param dt: none (clock object (time elapsed)) - :return: - """ - #This update function is the main update function for the game - #events are setup here as well - #update game objects - #update mixtape - self.mixtape.update() - #update rappers - #randomly add an rapper - tmpCount = randint(1,1800) - print self.minProb - #overtime difficulty increase - if tmpCount > self.minProb: - self.addrapper() - self.minProb = self.minProb - 0.10 - #peak difficulty - if self.minProb <= 1750: - self.minProb = self.minProb + 0.1 - if self.mixtape.y < Window.height * 0.001: - self.mixtape.impulse = 10 - for k in self.rapperList: - #check for collision with mixtape - if k.collide_widget(self.mixtape): - print 'death' - #game over routine - self.gameOver() - Clock.unschedule(self.update) - self.rapperScore = 0 - #when rappers past the left screen - if k.x < -100: - self.remove_widget(k) - self.rapperScore += 1 - tmpRapperList = self.rapperList - tmpRapperList[:] = [x for x in tmpRapperList if (x.x > - 100)] - self.RapperList = tmpRapperList - k.update() +