Ultimate Python Turtle Graphics Tutorial: Space Arena 2 (Sprite Class)

preview_player
Показать описание


NEED HELP?

❤️❤️ SHOW SOME LOVE AND SUPPORT THE CHANNEL ❤️❤️

Click Join and Become a Channel Member Today!
Channel members can get preferential comment replies, early access to new content, members only live streams, and access to my private Discord.

Amazon Affiliate Links

Other Affiliate Links

LINKS

LEARN MORE PYTHON

LEARN MORE JAVA

#Python #Tutorial #Beginner
Рекомендации по теме
Комментарии
Автор

you said this is not an object oriented basics tutorial and you still explained the basics anyway😊 we love a subconscious educator

nuklearboysymbiote
Автор

If anybody is confused about the `player.render(pen)`... render() is a method of the class Sprite. It accepts two arguments, self and pen. The `player.render(pen)` command can also be written as `Sprite.render(player, pen)`. This way, you can easily see that the self in the list of arguments for the method is the player sprite.

bokkenka
Автор

Hey why is it showing line under line 42 45 47 and it is not showing the player and enemy???

iyadmohiuddin
Автор

what

def render(self, pen):
^
IndentationError: unindent does not match any outer indentation level

means?

yoshizingordin
Автор

Hi quick question. I am trying to add sounds and im on windows but i don't know which sound system i am gonna use. Anyone here in the comments who knows?

PONTAAAN
Автор

hello, i am getting the error "unsupported operand type(s) for / 'str' and 'str'" what do i do?

SimplyHero
Автор

The best tutorial for gaming in python. Thank you so much.

maryamalbalushi
Автор

Thanks for explaining that "self" thing in the simplest of terms. Been avoiding classes because it looked too much of a hassle. Finished your SPACE INVADERS & FLAPPY BIRD tutorials. I wish the Flappy Bird could flap its wings. Just one question, how would we implement animated sprites without classes, without OOPS, like in Turbo C and graphics.h on DOSBOX.

arifkasim
Автор

Hey TokyoEDTech! Could you please explain to me what "stamp" does. Its the first time I am seeing it

shaharyarahmed
Автор

Can't we add images instead of shapes?

manas
Автор

Since you have only one pen, you don't need to define the pen with the render function.
A simple "player.render()" will do.

Sebastian--
Автор

Amazing video :). May I know what you do in Japan? I'm really curious and love japan. I hope you don't mind 😅.
Thx

BelTwitex
Автор

Hi TokyoEdTech i had a doubt, wht does the render command do ?

scorpionking_gameryt
Автор

Hello Sir, It is coming that "Sprite() takes no arguments", so then what we have to
Please Tell me sir🙏🙏

nirmitbaria
Автор

hey can someone pls help me out. I am getting an error that says sprite takes no arguments. i dont have pastebin so i have mentioned the code below:

import turtle

SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600

wn = turtle.Screen()
wn.setup(SCREEN_WIDTH, SCREEN_HEIGHT)
wn.title("Space arena! by @Sidak")
wn.bgcolor("black")

pen = turtle.Turtle()
pen.speed(0)
pen.shape("square")
pen.color("white")
pen.penup()
pen.hideturtle()

class Sprite():
#Constructor
def _init_(self, x, y, shape, color):
self.x = x
self.y = y
self.shape = shape
self.color = color

def render(self, pen):
pen.goto(self.x, self.y)
pen.shape(self.shape)
pen.color(self.color)

#Create my player sprite
player = Sprite(0, 0, "square", "white")
player.render(pen)

wn.mainloop()

sidaksingh
Автор

I have an error like this "TypeError: Sprite() takes no arguments "

rkanitt
Автор

How many episodes are there going to be for this?

andrewdanub
Автор

when will you go live if you do, do it on space arena plz

LammiSalami
Автор

Can u please make a video where u tell us when, where, how to use classes....Pls its a request

sujalpandey
Автор

hello !, i am having an error saying-

Traceback (most recent call last):
File squabbles .py", line 36, in <module>
player= Sprite(0, 0, "square", "white")
NameError: name 'Sprite' is not defined

even though i put 2 underscores for the "init"
the code is given below


the code (till now) is-

from re import X
from tkinter import Y
import turtle


screen_width=800
screen_hight=600

wn=turtle.Screen()
wn.setup(screen_width, screen_hight)
wn.title("Underwater Squabbles: When The Arenas Open")
wn.bgcolor("blue")

pen = turtle.Turtle()
pen.speed(0)
pen.shape("square")
pen.color("white")
pen.penup()
pen.hideturtle()

class sprite():
def __init__ (self, x, y, shape, color):
self.x =X
self.y =Y
self.shape=shape
self.color=color

def render(self, pen):
pen.goto(self.x, self.y)
pen.shape(self.shape)
pen.color(self.color)
pen.stamp()

player= Sprite(0, 0, "square", "white")
player.render(pen)


wn.mainloop()

forvrbuzzstudios