This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from random import randint, choice | |
def return_list(num_to_try,numbers_dictionary): | |
first = randint(1,6) | |
list_fig = [int(numbers_dictionary[first])] | |
called = [first] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import pygame as pg | |
class MouseTester(object): | |
def __init__(self): | |
self.done = False | |
self.clock = pg.time.Clock() | |
self.screen = pg.display.set_mode((800, 800)) | |
self.center_rect = pg.Rect(0, 0, 10, 10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import pygame,sys | |
from pygame.locals import * | |
from colors import * | |
from MySprite import * | |
from MyPlayerObject import * | |
#Audio - ogg or wav | |
pygame.init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""A module of funtions dealing with angles in pygame. | |
All functions (other than project) take lists or tuples | |
of pygame coordinates as origin, destination | |
and return the appropriate angle in radians. | |
""" | |
from math import pi, cos, sin, atan2, degrees, radians | |
import pygame as pg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import sin, cos, pi, atan2 | |
import pygame as pg | |
def get_angle(origin, destination): | |
"""Returns angle in radians from origin to destination. | |
This is the angle that you would get if the points were | |
on a cartesian grid. Arguments of (0,0), (1, -1) | |
return .25pi(45 deg) rather than 1.75pi(315 deg). | |
""" | |
x_dist = destination[0] - origin[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import sin, cos, pi, atan2 | |
import pygame as pg | |
def get_angle(origin, destination): | |
"""Returns angle in radians from origin to destination. | |
This is the angle that you would get if the points were | |
on a cartesian grid. Arguments of (0,0), (1, -1) | |
return .25pi(45 deg) rather than 1.75pi(315 deg). | |
""" | |
x_dist = destination[0] - origin[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from math import pi, tan | |
import pygame as pg | |
from angles import get_angle, project | |
def get_edge_pos(origin, angle, rect): | |
"""Returns the intersection of the ray from | |
origin at angle with the edge of rect. origin | |
should be a point inside rect.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Functions for pygame pathfinding. | |
""" | |
import pygame as pg | |
class Cell(object): | |
def __init__(self, index, cell_size, occupant=None): | |
self.index = index | |
self.occupant = occupant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools as it | |
import pygame as pg | |
#IMAGE LOADING | |
#a list of all image names | |
image_names = ["EnemyMoverRed", "EnemyMoverBlue", "BossMoverRed"] | |
#Make a dict to hold the images so they're only loaded once. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# Sample hueberry | |
# written in Python | |
# John Gamble 15/01/2015 | |
import sys, pygame | |
import phue | |
import time | |
from phue import Bridge | |
OlderNewer