Python Game Programming Tutorial: Space Invaders 1

Check out more tutorials on my blog: http://christianthompson.com/

Follow me on Twitter: https://twitter.com/tokyoedtech

And please SUBSCRIBE to my channel here: https://www.youtube.com/channel/UC2vm-0XX5RkWCXWwtBZGOXg

Comments

Hudson White says:

Thankyou for creating this video, has helped me alot 🙂

Anshuman Seetharaman says:

Do you have any tutorials on how exactly the turtle module can be used to create games?

Ale Ale says:

oh and also you should make a de-bugging tutorial that would be grate of cheese (im italian so sorry for the bad joke)

Ale Ale says:

wow ur amazing thanks so much you gave me a boost in learning python! your the man to go to when you need help coding

PatriotAct says:

It opens a new window and it looks fine, but it does not run and I just get Space Invaders (not responding) and it crashes. What did I do wrong? I know its not a complete code but I shouldn’t need to enter anymore for the screen to at least stay open. And note that I am not talking about how it originally closes immediately after opening, it stays open but just doesnt work.

import os
import turtle

wn = turtle.Screen()
wn.bgcolor(“black”)
wn.title(“Space Invaders”)

Mohammed Ahmed says:

sorry for writing to you directly but
Dear Mr. Thomson,
I am getting this error but I do not know why?
File “C:/Users/Lab/PycharmProjects/HelloWorld/SpaceInvaders/Invade.py”, line 14, in
wn = turtle.screen()
AttributeError: module ‘turtle’ has no attribute ‘screen’

Process finished with exit code 1
the code block is @:
http://christianthompson.com/sites/default/files/Space_Invaders/Space-Invaders-Tutorial-10.py
Imean this is your code

dccooltiger says:

Traceback (most recent call last):
File “C:/Users/Georg/PycharmProjects/space invaders/turtles.py”, line 5, in
main = turtle.screen()
AttributeError: module ‘turtle’ has no attribute ‘screen’

any help with this error? im on python 3.6 (edit: i fixed the problem now)

MACHINE_BUILDER says:

Loved The Video! Subscribed…
*Thanks!!!*
_#LovePython_

Vuldin says:

border_pen = turtle.Turtle() is not working :p

SkullMaster 1785 -Gaming And More says:

To tutorial for this in 3.6

Proma says:

Turtle sounds so much like the turtle in LOGO

Popocraft says:

what’s turtle

Eystem says:

It worked up until the creating the border where my window just said not responding please help me!!!!

Dylan Loom says:

Hi there , I have copied the code exactly to how yours is on notepad++ I save the file. Then open it as I would in a normal document. And a screen opens for a second then closes. Should I be using a different ide or do I need any plugins etc

Pawel Charkiewicz says:

i have problem with the 5 line “import os” i get a message that ‘ “os” imported but unused’

Alex Rubis says:

AttributeError: ‘_Screen’ object has no attribute ‘speed’ what should i do ?:D

UltraProbe says:

Your so awesome 😀

Tanush Shrivastava says:

whenever I try to run it off of my raspberry pi it says error syntax
this is my code

>>> import turtle
>>> import os
>>> wn = turtle.Screen()
>>> wn.bgcolor(“Black”)
>>> wn.title(“Space Invaders”)
>>> pen = turtle.Turtle()
>>> pen.color(“white”)
>>> pen.speed(0)
>>> pen.penup()
>>> pen.setposition(-300,-300)
>>> pen.pendown()
>>> for x in range(4):
pen.forward(600)
pen.lt(90)

>>> pen.hideturtle()
>>> character = turtle.Turtle()
>>> character.shape(“triangle”)
>>> character.speed(0)
>>> character.setposition(0,-250)
>>> character.setheading(90)
>>> character.color(“blue”)

Pengulous says:

If i put the border at -300,-300 then it is too big for the screen and all i see is the left and right sides of it anyone help?

kresna maheswara says:

hello chris how i learn python in package library

Cool Ice says:

Im using Jupyter and its running python 3 and the border_pen.penup() isnt working its having error??

WeirdButCoolGaming And Mapping says:

PS:For python 3 use input instead and dont use the delay otherwise the name would be Python Turtle Graphics

SlyFox says:

I’m getting back “This application has requested the Runtime to terminate it in an unusual way. ” when I try to make the screen. The window crashes immediately along with my kernel. I don’t know what to do here.

Tacticalswitch says:

The window that appears keeps crashing when I press “Run”. Says SPace Invaders and shows the turtle, just not responding.

ErNrGc says:

It always crash… why?! I am on Windows Pythn 3.6 (Solved)
The “”delay = input(“press enter to finish”)”” cause problems so put “turtle.mainloop()”.
(know that “raw_input” doesn’t work)

PD: Good vids :3

waste yrself says:

Hey im programming in the python that comes with visual studio code, but it doesn’t recognize “wn” as anything. help please?

Em Dc says:

Good video, great tutorial

Michael Sawarynski says:

Where is he coding the python, and what does he have open to run the game?

Jean Neves says:

great tutorial, keep up with this work!!!!

Amir Al-Murad says:

import turtle
import os
turtle.mainloop()

#screen
gameScreen = turtle.screen()
gameScreen.bgcolor(“black”)
gameScreen.title(“Space Invaders”)

delay = input(“press enter”)

#Draw border
border_pen = turtle.Turtle()
border_pen.speed(0)
border_pen.color(“White”)
border_pen.penup()
border_pen.setposition(-300,-300)
borderpen
border_pen.pensize(3)
for side in range (4):
border_pen.fd(600)
border_pen.lt(90)
border_pen.hideturtle()

I am getting the screen but it is just white and that is it and i dont get the black screen with green text.
windows 10
python 3
i would appreciate it if you would help

Le Grand Duelliste says:

Hi, I’m using python 3 but all it the screen and borders don’t stay on, they appear and disappear straight away.
Here’s the code, I copy pasted the exact one.

import turtle
import os

# Set up screen
wn = turtle.Screen()
wn.bgcolor(“black”)
wn.title(“Space Invaders”)

# Draw border
border_pen = turtle.Turtle()
border_pen.speed(0)
border_pen.color(“white”)
border_pen.penup()
border_pen.setposition(-300, -300)
border_pen.pendown()
border_pen.pensize(3)
for side in range(4):
border_pen.fd(600)
border_pen.lt(90)
border_pen.hideturtle()

# Create player turtle
player = turtle.Turtle()
player.color(“blue”)
player.shape(“triangle”)
player.penup()
player.speed(0)
player.setposition(0, -250)
player.setheading(90)

JRM Productions says:

I’m getting invalid syntax messages can someone help.

#Space Invaders – part1
#set up the screen
#Python 2.7 on raspberry pi
import turtle
import os

#Set up the screen
wn = turtle.Screen()
wn.bgcolor(“black”)
wn.title(“Space Invaders”)

#Draw border
border_pen = turtle.Turtle()
border_pen.speed(0)
border_pen.color(“white”)
border_pen.penup()
border_pen.setposition(-300,-300)
border_pen.pendown()
border_pen.pensize(3)
for side in range(4):
border_pen.fd(600)
border_pen.lt(90)
border_pen.hideturtle()

#creat the player turtle
player = turtle.Turtle()
player.color(“blue”)
player.shape(“triangle”)
player.penup()
player.speed(0)
player.setpostion(0, -250

delay = input(“Press enter to finish”)

DedKat says:

I need help, the delay = raw_input(“Press enter to finish”) does not work on later versions. I have used”turtle.mainloop()” but to no avail. any suggestions?

dccooltiger says:

great tutorial im learning python myself its fun to code!

DNZ DMRL says:

I like raw ”tutorial” like this. Because it gets you into action instantly, while explaining this along the way. Thank you so much!

Everything central says:

Nice job with the code!!

 Write a comment

*

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!