[go: up one dir, main page]

0% found this document useful (0 votes)
14 views2 pages

Snake Game Data Classes Overview

Uploaded by

rsz90184
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Snake Game Data Classes Overview

Uploaded by

rsz90184
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

index

gamedata c:\users\jaffar\softwareprojects\snake-hunt\gamedata.py

Classes
builtins.object

CellData
GameData
LeaderboardEntry

class CellData(builtins.object)
CellData(position, color, width, direction=None)

A class containing info needed to render a block.

A block is a generic rectangle that can represent anything.

Attributes
----------
position (tuple[int, int]):
Position of the block

color (tuple[int, int, int]):


Color of the block

width (int):
Width of the block

direction (tuple[int, int]):


Direction of the block

Methods defined here:

__init__(self, position, color, width, direction=None)


Initialize CellData.

Data descriptors defined here:

__dict__
dictionary for instance variables (if defined)

__weakref__
list of weak references to the object (if defined)

class GameData(builtins.object)
GameData(snake, snakes, pellets, leaderboard, sound=None)

Class holding everything that is needed to render the game.

Attributes
----------
snake (Snake):
Receiving client's snake

snakes (list):
List of other snakes in game (excluding receiver)

pellets (list):
List of pellets in the game

leaderboard (list):
List of top players and their scores

sound (comm.Message):
The sound file to play during this frame

Methods defined here:

__init__(self, snake, snakes, pellets, leaderboard, sound=None)


Initialize game data.

Data descriptors defined here:

__dict__
dictionary for instance variables (if defined)

__weakref__
list of weak references to the object (if defined)

class LeaderboardEntry(builtins.object)
LeaderboardEntry(name, score)

A class representing a leaderboard entry.

Attributes
----------
name (str):
Name of a player

score (int):
Score of the player

Methods defined here:

__init__(self, name, score)


Create leaderboard entry.

Data descriptors defined here:

__dict__
dictionary for instance variables (if defined)

__weakref__
list of weak references to the object (if defined)

You might also like