filmov
tv
Python / Pygame Tutorial 7 - Sprite Class (Part 1/2)

Показать описание
The next Python / Pygame tutorial. We look at how to make a simple class that we can use to create a sprite object. We create the __init__ method and we create our own method, the render method.
Download the completed project (from parts 1 and 2):
Code:
import pygame
black = (0,0,0)
white=(255,255,255)
moveX,moveY=0,0
class Sprite:
def __init__(self,x,y):
self.x=x
self.y=y
def render(self):
player=Sprite(100,150)
player2=Sprite(200,300)
gameLoop=True
while gameLoop:
gameLoop=False
moveX = -5
moveX = 5
moveY = -5
moveY = 5
moveX=0
moveX=0
moveY=0
moveY=0
player.x+=moveX
player.y+=moveY
Download the completed project (from parts 1 and 2):
Code:
import pygame
black = (0,0,0)
white=(255,255,255)
moveX,moveY=0,0
class Sprite:
def __init__(self,x,y):
self.x=x
self.y=y
def render(self):
player=Sprite(100,150)
player2=Sprite(200,300)
gameLoop=True
while gameLoop:
gameLoop=False
moveX = -5
moveX = 5
moveY = -5
moveY = 5
moveX=0
moveX=0
moveY=0
moveY=0
player.x+=moveX
player.y+=moveY
PyGame Tutorial 7 - PyGame RESIZABLE flag
Pygame Tutorial - 7 - Adding boundaries to our game
Pygame Tutorial #7 - Die Leben des Gegners & Kollisionen
Python / Pygame Tutorial 7 - Sprite Class (Part 1/2)
Pygame Tutorial #7 - Collision and Hit Boxes
Pygame - Create game in python || Pygame python tutorial #python #pygame
Pygame Tutorial - Making a Platformer ep. 7: Infinite Worlds & Optimization
Pygame (Python Game Development) Tutorial - 7 - Moving Rectangle
Python Pygame Tutorial - Episode 7! Creating Increasing Difficulty and Progressive Movement Speed!
Pygame Tutorial - Part 7 - Object Orientation in Pygame
Python / Pygame Tutorial 7 - Sprite Class (Part 2/2)
Collision Detection in Pygame | Pygame Tutorial #7
Pygame Tutorial 7 - Continuous Snake Movement
python pygame (game development) video 7 score and level system
Camera | Coding Terraria in Python | Pygame Tutorial Ep. 7
Pygame Python Game Development Tutorial 7 Moving Rectangle
Pygame tutorial #7 - setting up and coins and obstacles
LEVEL UP Your Python Game!! #python #coding #programming
Python Pygame Full Course - Part 7 | Easy, Simple Beginner Pygame Tutorials | Space Invaders
Pygame Tutorial #7 Hitboxen und Kollision
Making mario using pygame in python #python #pythonexamples #pythonprogramming
Pygame Space Invaders Beginner Tutorial in Python - PART 7 | Explosions Using Sprite Animations
Pygame tutorial-7- Inserting music
Basic Games In Python | Pygame Tutorial (Part - 7)
Комментарии