|
From: João <lv...@us...> - 2009-12-08 02:17:42
|
This is an automated email from the git, the tree hashes are:
via df68da5eea203fc158360dc9efbf564361c04e3f (commit)
from 174d90a8487f598ed829470a9410257543aef0b7 (commit)
- Log -----------------------------------------------------------------
commit df68da5eea203fc158360dc9efbf564361c04e3f
Author: João <jcorrea@marvim.(none)>
Date: Tue Dec 8 00:09:44 2009 -0200
Adding zigzaglong behaviour to enemies and support to y position
diff --git a/code/enemy.py b/code/enemy.py
index c5ce3ea..a0a516b 100644
--- a/code/enemy.py
+++ b/code/enemy.py
@@ -34,7 +34,8 @@ class Enemy(Actor):
"fast":[-7,0],
"diagonal":[-3,1],
"seeker":[-3,1],
- "zigzag":[-3,1]
+ "zigzag":[-3,-8],
+ "zigzaglong":[-3,-8]
}
self.counter = 1
@@ -54,6 +55,14 @@ class Enemy(Actor):
else:
self.speed = [-3, 8]
self.orientation = False
+ if self.behaviour == "zigzaglong":
+ if self.counter % 30 == 0:
+ if self.orientation == False:
+ self.speed = [-3, -8]
+ self.orientation = True
+ else:
+ self.speed = [-3, 8]
+ self.orientation = False
elif self.behaviour == "seeker":
if self.counter %2 == 0:
if self.orientation == True:
diff --git a/code/game.py b/code/game.py
index 32dd0db..4e983d8 100644
--- a/code/game.py
+++ b/code/game.py
@@ -412,7 +412,10 @@ class Game:
enemy = Enemy([0, 0], 0, int(element.life), element.behaviour,
0, self.image_enemy)
size = enemy.get_size()
- y = Random.randint(size[1] / 2, self.screen_size[1] - size[1] / 2)
+ # FIX: Should random y be kept like below?
+ y = int(element.pos_y)
+ if y == 0:
+ y = Random.randint(size[1] / 2, self.screen_size[1] - size[1] / 2)
pos = [self.screen_size[0] + size[0] / 2, y]
enemy.set_pos(pos)
# add sprite to group
diff --git a/data/stage1.xml b/data/stage1.xml
index f77bbee..672b05a 100644
--- a/data/stage1.xml
+++ b/data/stage1.xml
@@ -10,18 +10,84 @@
<type>enemy</type>
<cc>100</cc>
<pos_x>0</pos_x>
- <pos_y>40</pos_y>
+ <pos_y>300</pos_y>
<speed>0</speed>
<life>1</life>
<image>none</image>
- <behaviour>zigzag</behaviour>
+ <behaviour>zigzaglong</behaviour>
+ <special>0</special>
+</item>
+<item>
+ <type>enemy</type>
+ <cc>150</cc>
+ <pos_x>0</pos_x>
+ <pos_y>300</pos_y>
+ <speed>0</speed>
+ <life>1</life>
+ <image>none</image>
+ <behaviour>zigzaglong</behaviour>
<special>0</special>
</item>
<item>
<type>enemy</type>
<cc>200</cc>
<pos_x>0</pos_x>
- <pos_y>30</pos_y>
+ <pos_y>300</pos_y>
+ <speed>0</speed>
+ <life>1</life>
+ <image>none</image>
+ <behaviour>zigzaglong</behaviour>
+ <special>0</special>
+</item>
+<item>
+ <type>enemy</type>
+ <cc>250</cc>
+ <pos_x>0</pos_x>
+ <pos_y>300</pos_y>
+ <speed>0</speed>
+ <life>1</life>
+ <image>none</image>
+ <behaviour>zigzaglong</behaviour>
+ <special>0</special>
+</item>
+<item>
+ <type>enemy</type>
+ <cc>300</cc>
+ <pos_x>0</pos_x>
+ <pos_y>300</pos_y>
+ <speed>0</speed>
+ <life>1</life>
+ <image>none</image>
+ <behaviour>zigzaglong</behaviour>
+ <special>0</special>
+</item>
+<item>
+ <type>enemy</type>
+ <cc>350</cc>
+ <pos_x>0</pos_x>
+ <pos_y>300</pos_y>
+ <speed>0</speed>
+ <life>1</life>
+ <image>none</image>
+ <behaviour>zigzaglong</behaviour>
+ <special>0</special>
+</item>
+<item>
+ <type>enemy</type>
+ <cc>400</cc>
+ <pos_x>0</pos_x>
+ <pos_y>300</pos_y>
+ <speed>0</speed>
+ <life>1</life>
+ <image>none</image>
+ <behaviour>zigzaglong</behaviour>
+ <special>0</special>
+</item>
+<item>
+ <type>enemy</type>
+ <cc>450</cc>
+ <pos_x>0</pos_x>
+ <pos_y>300</pos_y>
<speed>0</speed>
<life>1</life>
<image>none</image>
@@ -30,7 +96,7 @@
</item>
<item>
<type>background</type>
- <cc>200</cc>
+ <cc>500</cc>
<image>tiles/stars3.jpg</image>
<layer>1</layer>
</item>
-----------------------------------------------------------------------
Summary of changes:
code/enemy.py | 11 +++++++-
code/game.py | 5 +++-
data/stage1.xml | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
3 files changed, 84 insertions(+), 6 deletions(-)
--
Dead Channel is a sci-fi shoot 'em up game developed using pygame.
|