Skip to content

Commit

Permalink
last update. graphics finished
Browse files Browse the repository at this point in the history
  • Loading branch information
stocyr committed Jan 31, 2012
1 parent e71af51 commit 61ce754
Show file tree
Hide file tree
Showing 76 changed files with 43 additions and 28 deletions.
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
Deflectouch
==============

[Screenshots]
![game play](http://a4.sphotos.ak.fbcdn.net/hphotos-ak-ash4/336216_290902887635727_1130435368_o.jpg)__
![help screen](http://a6.sphotos.ak.fbcdn.net/hphotos-ak-ash4/412143_290904047635611_100001480546056_829367_173788384_o.jpg)
![levels](http://a8.sphotos.ak.fbcdn.net/hphotos-ak-ash4/325221_290902854302397_100001480546056_829364_127504812_o.jpg)__
![settings](http://a2.sphotos.ak.fbcdn.net/hphotos-ak-snc7/324444_290902874302395_100001480546056_829365_1671324817_o.jpg)


READ THIS FIRST
---------------
Expand All @@ -16,15 +20,6 @@ http://kivy.org/docs/installation/installation.html
heavily summarized version of the above one.


How to play
-----------


How to design own levels
------------------------



Copyright and Contact
---------------------

Expand All @@ -38,6 +33,18 @@ For comments, suggestions or other messages contact me at:
cyril.stoller@gmail.com


Credits
-------

* Sound:
* beep.ogg, reset.ogg, select.ogg and switch.ogg are from the game *GUNSHIP!* from Microprose
* All other sound files are created by myself
* Music:
* The deflectouch.ogg song is created by myself
* Images:
* www.gestureworks.com


Release Notes
-------------

Expand Down
3 changes: 2 additions & 1 deletion background.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,5 @@ def delete_all_deflectors(self):
self.remove_widget(deflector)
self.parent.deflector_list = []

self.parent.stockbar.recalculate_stock()
if self.parent.stockbar is not None:
self.parent.stockbar.recalculate_stock()
8 changes: 4 additions & 4 deletions bullet.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ def create_animation(self, speed, destination):
def calc_destination(self, angle):
# calculate the path until the bullet hits the edge of the screen
win = self.get_parent_window()
left = 130
right = win.width - 144
top = win.height - 23
bottom = 96
left = 150.0 * win.width / 1920.0
right = win.width - 236.0 * win.width / 1920.0
top = win.height - 50.0 * win.height / 1920.0
bottom = 96.0 * win.height / 1920.0

bullet_x_to_right = right - self.center_x
bullet_x_to_left = left - self.center_x
Expand Down
4 changes: 2 additions & 2 deletions deflectouch.kv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## IcarusTouch# # Copyright (C) 2012 Cyril Stoller# # For comments, suggestions or other messages, contact me at:# <cyril.stoller@gmail.com># # This file is part of Deflectouch.# # Deflectouch is free software: you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation, either version 3 of the License, or# (at your option) any later version.# # Deflectouch is distributed in the hope that it will be fun,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.# # You should have received a copy of the GNU General Public License# along with Deflectouch. If not, see <http://www.gnu.org/licenses/>.##:kivy 1.0
#:import kivy kivy#:import win kivy.core.window# Background description:<Background>: source: self.source allow_stretch: True keep_ratio: False size: win.Window.size# Stock Bar description<Stockbar>: source: 'graphics/beta/deflector_blue_beta2.png' allow_stretch: True keep_ratio: False size_hint: None, None pos: self.pos size: self.max_stock, 20 Image: source: 'graphics/beta/stock_bar_limiter_l_beta.png' size_hint: None, None size: 51, 51 y: root.center_y - self.height/2 right: root.x Image: source: 'graphics/beta/stock_bar_limiter_r_beta.png' size_hint: None, None size: 51, 51 y: root.center_y - self.height/2 x: root.x + root.max_stock# Tank description:<Tank>: tank_tower_scatter: tank_tower_scatter tank_image_source: root.tank_image_source tower_image_source: root.tower_image_source # I want the tank image to be the bounding box: #size: tank_image.size size: 92, 149 Image: id: 'tank_image' source: root.tank_image_source size: 92, 149 pos: root.pos Scatter: id: tank_tower_scatter size_hint: None, None size: 196, 76 center: root.center do_rotation: False do_scale: False do_translation: False Image: source: root.tower_image_source size: 196, 76 pos: self.pos
# Deflector description:<Deflector>: point1: point1 point2: point2 pos: self.pos Image: id: point1 size: 40/root.scale, 40/root.scale pos: self.pos source: 'graphics/beta/finger_point_white_beta.png' color: 0, 0, 1, 1 allow_stretch: True Image: id: point2 size: 40/root.scale, 40/root.scale pos: self.pos source: 'graphics/beta/finger_point_white_beta.png' color: 0, 0, 1, 1 allow_stretch: True# Image:# id: deflector_line# allow_stretch: True# keep_ratio: False# # canvas:# BorderImage:# source: 'graphics/beta/deflector_blue_beta.png'# border: 10, 10, 10, 10# size: self.width+10*2, self.height+10*2# pos: self.x-10, self.y-10# Bullet description:<Bullet>: source: 'graphics/bullet.png' size: 35, 35 size_hint: None, None# Setting dialog description<SettingDialog>: music_slider: music_slider sound_slider: sound_slider speed_slider: speed_slider close_button: close_button orientation: 'vertical' padding: 10 spacing: 10 Label: text: 'Music Volume:' Slider: id: music_slider Widget: heigth: 5 Label: text: 'Sound Volume:' Slider: id: sound_slider Widget: heigth: 5 Label: text: 'Bullet Speed:' Slider: id: speed_slider range: 1, 10 Widget: heigth: 10 BoxLayout: spacing: 10 Button: text: 'Help' bold: True on_press: root.display_help_screen() font_size: 15 size_hint: 1, 1.5 Button: id: close_button text: 'Close' bold: True on_press: root.dismiss_parent() font_size: 15 size_hint: 1, 1.5 # Main widget description:<DeflectouchWidget>: tank: tank background: background pos: self.pos size: win.Window.size Background: id: background source: 'graphics/beta/background_beta.jpg' Image: source: 'graphics/beta/overlay_beta.png' allow_stretch: True keep_ratio: False size: win.Window.size Image: source: 'graphics/beta/rails_beta.png' center_x: win.Window.width/20 size_hint: None, None height: win.Window.height Tank: id: tank tank_image_source: 'graphics/beta/tank_beta.png' tower_image_source: 'graphics/beta/tank_tower_beta.png' center: win.Window.width/20, win.Window.center[1] BoxLayout: orientation: 'vertical' spacing: 15 padding: 20 size: win.Window.width/8, win.Window.height/2.3 right: win.Window.width top: win.Window.height Button: text: 'Fire' bold: True font_size: 17 on_press: root.fire_button_pressed() Button: text: 'Reset' bold: True font_size: 17 on_press: root.reset_button_pressed() Label: text: 'Lives: ' + str(root.lives) bold: True font_size: 17 size_hint: 1, 0.5 color: 0, 0, 0, 1 Button: text: 'Level ' + str(root.level) bold: True font_size: 17 on_press: root.level_button_pressed() Widget: size_hint: 1, 0.5 Button: text: 'Settings' bold: True font_size: 15 on_press: root.settings_button_pressed()
#:import kivy kivy#:import win kivy.core.window# Background description:<Background>: source: self.source allow_stretch: True keep_ratio: False size: win.Window.size# Stock Bar description<Stockbar>: source: 'graphics/deflector_blue.png' allow_stretch: True keep_ratio: False size_hint: None, None pos: self.pos size: self.max_stock, 20 Image: source: 'graphics/stockbar_limiter_l.png' size_hint: None, None size: 51, 51 y: root.center_y - self.height/2 right: root.x Image: source: 'graphics/stockbar_limiter_r.png' size_hint: None, None size: 51, 51 y: root.center_y - self.height/2 x: root.x + root.max_stock# Tank description:<Tank>: tank_tower_scatter: tank_tower_scatter tank_image_source: root.tank_image_source tower_image_source: root.tower_image_source # I want the tank image to be the bounding box: #size: tank_image.size size: 96, 140 Image: id: 'tank_image' source: root.tank_image_source size: 96, 140 pos: root.pos Scatter: id: tank_tower_scatter size_hint: None, None size: 210, 30 center: root.center do_rotation: False do_scale: False do_translation: False Image: source: root.tower_image_source size: 210, 30 pos: self.pos
# Deflector description:<Deflector>: point1: point1 point2: point2 pos: self.pos Image: id: point1 size: 40/root.scale, 40/root.scale pos: self.pos source: 'graphics/finger_point_white.png' color: 0, 0, 1, 1 allow_stretch: True Image: id: point2 size: 40/root.scale, 40/root.scale pos: self.pos source: 'graphics/finger_point_white.png' color: 0, 0, 1, 1 allow_stretch: True# Image:# id: deflector_line# allow_stretch: True# keep_ratio: False# # canvas:# BorderImage:# source: 'graphics/beta/deflector_blue_beta.png'# border: 10, 10, 10, 10# size: self.width+10*2, self.height+10*2# pos: self.x-10, self.y-10# Bullet description:<Bullet>: source: 'graphics/bullet.png' size: 35, 35 size_hint: None, None# Setting dialog description<SettingDialog>: music_slider: music_slider sound_slider: sound_slider speed_slider: speed_slider close_button: close_button orientation: 'vertical' padding: 10 spacing: 10 Label: text: 'Music Volume:' Slider: id: music_slider Widget: heigth: 5 Label: text: 'Sound Volume:' Slider: id: sound_slider Widget: heigth: 5 Label: text: 'Bullet Speed:' Slider: id: speed_slider range: 1, 10 Widget: heigth: 10 BoxLayout: spacing: 10 Button: text: 'Help' bold: True background_normal: 'graphics/button_normal.png' background_down: 'graphics/button_down.png' font_size: 15 size_hint: 1, 1.5 on_release: root.display_help_screen() Button: id: close_button text: 'Close' bold: True background_normal: 'graphics/button_normal.png' background_down: 'graphics/button_down.png' font_size: 15 size_hint: 1, 1.5 on_press: root.dismiss_parent()# Main widget description:<DeflectouchWidget>: tank: tank background: background pos: self.pos size: win.Window.size Background: id: background source: 'graphics/background.jpg' Image: source: 'graphics/overlay.png' allow_stretch: True keep_ratio: False size: win.Window.size Image: source: 'graphics/rails.png' center_x: win.Window.width/20 size_hint: None, None height: win.Window.height Tank: id: tank tank_image_source: 'graphics/tank.png' tower_image_source: 'graphics/tank_tower.png' center: win.Window.width/20, win.Window.center[1] BoxLayout: orientation: 'vertical' spacing: 15 padding: 20 size: win.Window.width/8, win.Window.height/2.0 right: win.Window.width top: win.Window.height Button: text: 'Fire' bold: True font_size: 17 background_normal: 'graphics/button_normal.png' background_down: 'graphics/button_down.png' on_press: root.fire_button_pressed() Button: text: 'Reset' bold: True font_size: 17 background_normal: 'graphics/button_normal.png' background_down: 'graphics/button_down.png' on_press: root.reset_button_pressed() Label: text: 'Lives: ' + str(root.lives) bold: True font_size: 18 size_hint: 1, 0.5 color: 1, 1, 1, 1 Button: text: 'Level ' + str(root.level) bold: True font_size: 17 background_normal: 'graphics/button_normal.png' background_down: 'graphics/button_down.png' on_press: root.level_button_pressed() Widget: size_hint: 1, 0.5 Button: text: 'Settings' bold: True font_size: 15 background_normal: 'graphics/button_normal.png' background_down: 'graphics/button_down.png' on_press: root.settings_button_pressed() Button: text: 'Exit' bold: True font_size: 17 background_normal: 'graphics/button_normal.png' background_down: 'graphics/button_down.png' on_press: root.app.stop()
Expand Down
File renamed without changes
Binary file removed graphics/beta/5x5.png
Binary file not shown.
Binary file removed graphics/beta/brick1.png
Binary file not shown.
Binary file removed graphics/beta/brick2.png
Binary file not shown.
Binary file removed graphics/beta/brick3.png
Binary file not shown.
Binary file removed graphics/beta/brick4.png
Binary file not shown.
Binary file removed graphics/beta/bullet_beta.png
Binary file not shown.
Binary file removed graphics/beta/circle_beta.png
Binary file not shown.
Binary file removed graphics/beta/deflector_blue_beta.png
Binary file not shown.
Binary file removed graphics/beta/deflector_red_beta.png
Binary file not shown.
Binary file removed graphics/beta/finger_point_blue_beta.png
Binary file not shown.
Binary file removed graphics/beta/finger_point_red_beta.png
Binary file not shown.
Binary file removed graphics/beta/finger_point_white_beta.png
Binary file not shown.
Binary file removed graphics/beta/goal1.png
Binary file not shown.
Binary file removed graphics/beta/help_screen_beta.png
Binary file not shown.
Binary file removed graphics/beta/overlay_beta.png
Binary file not shown.
Binary file removed graphics/beta/stock_bar_limiter_l_beta.png
Binary file not shown.
Binary file removed graphics/beta/stock_bar_limiter_r_beta.png
Binary file not shown.
Binary file removed graphics/beta/tank_beta.png
Binary file not shown.
Binary file removed graphics/beta/tank_tower_beta.png
Binary file not shown.
Binary file added graphics/brick1.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 graphics/brick2.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 graphics/brick3.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 graphics/brick4.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 graphics/button_down.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 graphics/button_normal.png
File renamed without changes
File renamed without changes
Binary file removed graphics/explosion.gif
Diff not rendered.
Binary file added graphics/finger_point_white.png
Binary file added graphics/goal1.png
Binary file added graphics/goal2.png
Binary file added graphics/goal3.png
Binary file added graphics/goal4.png
Binary file added graphics/help_screen.png
Binary file added graphics/overlay.png
File renamed without changes
Binary file added graphics/stockbar_limiter_l.png
Binary file added graphics/stockbar_limiter_r.png
Binary file added graphics/tank.png
Binary file added graphics/tank_tower.png
Binary file removed levels/level00.png
Diff not rendered.
Binary file modified levels/level05.png
Binary file modified levels/level07.png
Binary file added levels/level18.png
Binary file added levels/level19.png
Binary file added levels/level20.png
Binary file added levels/level22.png
Binary file added levels/level23.png
Binary file modified levels/level24.png
Binary file modified levels/level29.png
Binary file modified levels/level30.png
Binary file added levels/level31.png
Binary file added levels/level32.png
Binary file added levels/level33.png
Binary file added levels/level34.png
Binary file added levels/level36.png
Binary file added levels/level37.png
Binary file added levels/level38.png
21 changes: 14 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,11 @@ def settings_button_pressed(self):

def display_help_screen(self):
# display the help screen on a Popup
image = Image(source='graphics/beta/help_screen_beta.png')
image = Image(source='graphics/help_screen.png')

help_screen = Popup(title='Quick Guide through DEFLECTOUCH',
attach_to=self,
size_hint=(0.95, 0.95),
size_hint=(0.98, 0.98),
content=image)
image.bind(on_touch_down=help_screen.dismiss)
help_screen.open()
Expand Down Expand Up @@ -278,7 +278,7 @@ def bullet_exploding(self):

self.lives -= 1
if self.lives == 0:
self.reset_button_pressed()
self.reset_level()


def level_accomplished(self):
Expand Down Expand Up @@ -339,7 +339,7 @@ def load_level(self, level):
# and if the function was called by a button, play a sound
self.app.sound['select'].play()

# try to lead the level image
# try to load the level image
try:
level_image = kivy.core.image.Image.load('levels/level%02d.png' % level, keep_data=True)
except Exception, e:
Expand All @@ -348,6 +348,8 @@ def load_level(self, level):
return

# First of all, delete the old level:
self.reset_level()

for obstacle in self.obstacle_list:
self.background.remove_widget(obstacle)
self.obstacle_list = []
Expand All @@ -373,7 +375,7 @@ def load_level(self, level):

if color == [0, 0, 0]:
# create obstacle brick on white pixels
image = Image(source=('graphics/beta/brick%d.png' % randint(1, 4)),
image = Image(source=('graphics/brick%d.png' % randint(1, 4)),
x = LEVEL_OFFSET[0] + x * BRICK_WIDTH,
y = LEVEL_OFFSET[1] + (y-1) * BRICK_WIDTH,
size = (BRICK_WIDTH, BRICK_WIDTH),
Expand All @@ -384,7 +386,7 @@ def load_level(self, level):

elif color == [0, 0, 1]:
# create a goal brick on blue pixels
image = Image(source=('graphics/beta/goal%d.png' % randint(1, 1)),
image = Image(source=('graphics/goal%d.png' % randint(1, 4)),
x = LEVEL_OFFSET[0] + x * BRICK_WIDTH,
y = LEVEL_OFFSET[1] + (y-1) * BRICK_WIDTH,
size = (BRICK_WIDTH, BRICK_WIDTH),
Expand All @@ -408,7 +410,7 @@ def load_level(self, level):
self.max_stock = self.max_stock * self.width/1.4/LEVEL_WIDTH
self.stockbar = Stockbar(max_stock=self.max_stock,
x=self.center_x-self.max_stock/2,
center_y=self.height/15 + 20)
center_y=self.height/16 + 20)
self.add_widget(self.stockbar)

# now start to build up the level:
Expand Down Expand Up @@ -467,6 +469,7 @@ def build(self):
# start the background music:
self.music = SoundLoader.load('sound/deflectouch.ogg')
self.music.volume = self.config.getint('General', 'Music') / 100.0
self.music.bind(on_stop=self.sound_replay)
self.music.play()

# load all other sounds:
Expand Down Expand Up @@ -524,6 +527,10 @@ def build_config(self, config):

def welcome_screen(self, instance):
self.root.display_help_screen()

def sound_replay(self, instance):
if self.music.status != 'play':
self.music.play()


if __name__ in ('__main__', '__android__'):
Expand Down
Binary file modified sound/accomplished.ogg
Binary file not shown.
Binary file modified sound/bullet_start.ogg
Binary file not shown.
Binary file modified sound/deflection.ogg
Binary file not shown.
Binary file modified sound/deflector_delete.ogg
Binary file not shown.
Binary file modified sound/deflector_down.ogg
Binary file not shown.
Binary file modified sound/deflector_new.ogg
Binary file not shown.
Binary file modified sound/deflector_up.ogg
Binary file not shown.
Binary file modified sound/deflectouch.ogg
Binary file not shown.
Binary file modified sound/explosion.ogg
Binary file not shown.
Binary file modified sound/no_deflector.ogg
Binary file not shown.
4 changes: 2 additions & 2 deletions stockbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ def recalculate_stock(self):

if self.width < MIN_DEFLECTOR_LENGTH:
# if the stock material doesn't suffice for a new deflector, disable new deflectors
self.source = 'graphics/beta/deflector_red_beta2.png'
self.source = 'graphics/deflector_red.png'
self.new_deflectors_allowed = False
elif self.width <= 0:
# if all the stock material was used up, disable new deflectors
self.new_deflectors_allowed = False
else:
self.source = 'graphics/beta/deflector_blue_beta2.png'
self.source = 'graphics/deflector_blue.png'
self.new_deflectors_allowed = True

def new_deflector(self, length):
Expand Down
4 changes: 2 additions & 2 deletions tank.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ def on_touch_move(self, touch):
# if the current touch is already in the 'rotate' mode, rotate the tower.
dx = touch.x - self.center_x
dy = touch.y - self.center_y
angle = boundary(atan2(dy, dx) * 360 / 2 / pi, -80, 80)
angle = boundary(atan2(dy, dx) * 360 / 2 / pi, -60, 60)

angle_change = self.tank_tower_scatter.rotation - angle
rotation_matrix = Matrix().rotate(-radians(angle_change), 0, 0, 1)
self.tank_tower_scatter.apply_transform(rotation_matrix, post_multiply=True, anchor=(98, 38))
self.tank_tower_scatter.apply_transform(rotation_matrix, post_multiply=True, anchor=(105, 15))

elif touch.x > self.right:
# if the finger moved too far to the right go into rotation mode
Expand Down

0 comments on commit 61ce754

Please sign in to comment.