Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lessons/3-first-sprite.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ What if I don't like how big it is?

image = image.load("player.png")
scaled_image = smoothscale(image,
(image.get_width() * 0.5,
image.get_height() * 0.5))
( int(image.get_width() * 0.5),
int(image.get_height() * 0.5)) )
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code samples in this project follow PEP8, extra spaces around parentheses is not to style.

Could you remove them?

1 change: 1 addition & 0 deletions lessons/6-enemies.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Let's make some collisions!
enemies = self.groups["enemy"]
groupcollide(player, enemies, True, True)
groupcollide(enemies, bullets, True, True)
self.spawner.spawn(time_delta)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in lesson six, the scene doesn't have a spawner yet, so this will throw an error.

This line needs to be removed.


`groupcollide` takes two sprite groups and checks every sprite inside
against each other. The two booleans are telling group collide to kill
Expand Down
8 changes: 5 additions & 3 deletions lessons/7-spawning.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ So let's make a spawner!

def prime(self):
try:
self.next_spawn, self.next_position = next(self.generator)
self.next_time, self.next_position = next(self.generator)
except StopIteration:
self.running = False

Expand Down Expand Up @@ -65,12 +65,14 @@ Make a file called `spawn.csv` and let's populate it:

Now we'll make a new generator:

import csv

def file_spawner(file_name):
with open(path.join(path.dirname(__file__), file_name), "r") as spawn_file:
spawn_reader = csv.reader(csvfile)
spawn_reader = csv.reader(spawn_file)
for row in spawn_reader:
yield float(row[0]), int(row[1])

Then replace our simple spawner with this.

self.spawner = Spawner(self, file_spawner('spawn.csv'), Enemy)
self.spawner = Spawner(self, file_spawner('spawn.csv'), Enemy)