Exemplo n.º 1
0
"""
platformer.py
Author: 
Credit: 
Assignment:
Write and submit a program that implements the sandbox platformer game:
https://github.com/HHS-IntroProgramming/Platformer
"""
from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, PolygonAsset, ImageAsset, Frame

SCREEN_WIDTH = 1000
SCREEN_HEIGHT = 800

blue = Color(0x2EFEC8, 1.0)
black = Color(0x000000, 1.0)
pink = Color(0xFF00FF, 1.0)
red = Color(0xFF5733, 1.0)
white = Color(0xFFFFFF, 1.0)
red = Color(0xff0000, 1.0)
green = Color(0x00ff00, 1.0)
blue = Color(0x0000ff, 1.0)
black = Color(0x000000, 1.0)
white = Color(0xffffff, 1.0)
grey = Color(0xC0C0C0, 1.0)
thinline = LineStyle(2, black)
blkline = LineStyle(1, black)
noline = LineStyle(0, white)
coolline = LineStyle(1, grey)
blueline = LineStyle(2, blue)
redline = LineStyle(1, red)
greenline = LineStyle(1, green)
Exemplo n.º 2
0
"""
platformer.py
Author:waSclthu11
Credit:The example platformer program helped a lot, especially with subclasses, which I used for the terrain. Also Mr.Dennison helped with the collision detection setup.
Sprite credit link: https://goglilol.itch.io/cute-knight 
wall credit link: http://clipgoo.com/ja/215415107/80-93-castle/215415/
Write and submit a program that implements the sandbox platformer game:
https://github.com/HHS-IntroProgramming/Platformer

"""
x=1000
from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, TextAsset, EllipseAsset, PolygonAsset, ImageAsset, Frame
SCREEN_WIDTH = 1000
SCREEN_HEIGHT = 800
blue = Color(0x0000FF, 1.0)
black = Color(0x000000, 1.0)
pink = Color(0xFF00FF, 1.0)
red = Color(0xFF5733, 1.0)
white = Color(0xFFFFFF, 1.0)
red = Color(0xff0000, 1.0)
green = Color(0x00ff00, 1.0)
brown = Color(0x8B4513, 1.0) #8B4513
purple = Color(0x800080, 1.0)
white = Color(0xffffff, 1.0)
grey = Color(0xC0C0C0, 1.0)

thinline = LineStyle(2, black)
blkline = LineStyle(1, black)
noline = LineStyle(0, white)
coolline = LineStyle(1, grey)
blueline = LineStyle(2, blue)
Exemplo n.º 3
0
See:
https://github.com/HHS-IntroProgramming/Standards-and-Syllabus/wiki/Displaying-Graphics
for general information on how to use ggame.

See:
http://brythonserver.github.io/ggame/
for detailed information on ggame.

"""
from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, PolygonAsset

# add your code here \/  \/  \/

# Defining colors
red = Color(0xff0000, 1.0)
green = Color(0x00ff00, 1.0)
blue = Color(0x0000ff, 1.0)
black = Color(0x000000, 1.0)
white = Color(0xffffff, 1.0)

# Defining Lines
thinline = LineStyle(1, black)
# Creating Blueprint for each sprite
rectangle = RectangleAsset(400, 30, thinline, red)
rectangle2 = RectangleAsset(600, 30, thinline, red)
rectangle3 = RectangleAsset(200, 210, thinline, blue)
rectangle4 = RectangleAsset(20, 800, thinline, red)
circle = CircleAsset(20, thinline, black)
circle2 = CircleAsset(10, thinline, white)
polygon = PolygonAsset([(200, 130), (220, 180), (270, 180), (225, 215),
Exemplo n.º 4
0
from ggame import App
from ggame import App, Color, LineStyle, Sprite
from ggame import RectangleAsset, CircleAsset, EllipseAsset, PolygonAsset

# Three primary colors with no transparency (alpha = 1.0)
red = Color(0xff0000, 0.5)
green = Color(0x00ff00, 1.0)
blue = Color(0x0000ff, 1.0)
black = Color(0x000000, 1.0)

# Define a line style that is a thin (1 pixel) wide black line
thinline = LineStyle(1, black)
# A graphics asset that represents a rectangle
ellipse = EllipseAsset(20,30, thinline, blue)
polygon = PolygonAsset([(0,0), (50,0), (50,50), (0,50), (0,0)], thinline, red)

# Now display a rectangle
Sprite(ellipse)
Sprite(polygon)

myapp = App()
myapp.run()
Exemplo n.º 5
0
 def labelcolor(self):
     colorval = self.vslider1()
     return Color(colorval * 256, 1)
Exemplo n.º 6
0
5. One (or more) EllipseAsset objects.
6. One (or more) PolygonAsset objects.

See:
https://github.com/HHS-IntroProgramming/Standards-and-Syllabus/wiki/Displaying-Graphics
for general information on how to use ggame.

See:
http://brythonserver.github.io/ggame/
for detailed information on ggame.

"""
from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, PolygonAsset

# add your code here \/  \/  \/
red = Color(0xff0000, 1.0)
green = Color(0x00ff00, 1.0)
blue = Color(0x0000ff, 1.0)
black = Color(0x000000, 1.0)
brown = Color(0x663300, 1.0)

thinline = LineStyle(1, black)

rectangle = RectangleAsset(500, 700, thinline, red)
Sprite(rectangle, (600, 400))
rectangle = RectangleAsset(50, 70, thinline, black)
Sprite(rectangle, (825, 700))
polygon = PolygonAsset([(550, 400), (850, 250), (1150, 400)], thinline, green)
Sprite(polygon)
circle = CircleAsset(30, thinline, blue)
Sprite(circle, (850, 330))
Exemplo n.º 7
0
5. One (or more) EllipseAsset objects.
6. One (or more) PolygonAsset objects.

See:
https://github.com/HHS-IntroProgramming/Standards-and-Syllabus/wiki/Displaying-Graphics
for general information on how to use ggame.

See:
http://brythonserver.github.io/ggame/
for detailed information on ggame.

"""
from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, PolygonAsset

# add your code here \/  \/  \/
red = Color(0xff7043, 1.0)
green = Color(0x00ff00, 1.0)
blue = Color(0x0000ff, 1.0)
black = Color(0x000000, 1.0)
yellow = Color(0xffd54f, 0.9)
ltgray = Color(0xe0e0e0, 1.0)
roof = Color(0xbbdefb, 1.0)


thinline = LineStyle(1, black)

housebase = RectangleAsset(100, 50, thinline, red)
houseroof = PolygonAsset(([(300, 700), (400, 700), (350, 650), (350, 700)]), thinline, roof)
houseroof2 = PolygonAsset(([(200, 700), (300, 700), (350, 650), (350, 700)]), thinline, roof)
sun = EllipseAsset(100, 100, thinline, yellow)
pillar = RectangleAsset(2, 50, thinline, red)