# --------------------------------------------------------------
def is_simulation_over():
    return False


# --------------------------------------------------------------
# Analyzes the Results of the Simulation
# --------------------------------------------------------------
def analyze_results():
    pass


# -----------------------------------------------------
# "Main Program"
# -----------------------------------------------------
pythonGraph.open_window(WINDOW_WIDTH, WINDOW_HEIGHT)
pythonGraph.set_window_title(
    "CS110Z (S20) Rocket Simulator - YOUR NAME GOES HERE")

# Initializes the Simulation At Least Once
initialize_simulation(True)

# Main "Game Loop"
while pythonGraph.window_not_closed():
    if is_simulation_over() == False:
        erase_objects()
        draw_objects()
        get_input()
        update_objects()
    else:
        analyze_results()
Example #2
0
def config():
    # setup
    pythonGraph.open_window(700, 700)
    pythonGraph.clear_window(pythonGraph.colors.BLACK)
    pythonGraph.set_window_title('PythonGraph Draw')
Example #3
0
    if ball_2_x > 600 or ball_2_x < 0:
        ball_2_x_velocity = ball_2_x_velocity * -1

    if ball_2_y > 600 or ball_2_y < 0:
        ball_2_y_velocity = ball_2_y_velocity * -1

    distance = dist_points(ball_1_x, ball_1_y, ball_2_x, ball_2_y)
    if distance <= 2 * BALL_RADIUS:
        ball_1_x_velocity = ball_1_x_velocity * -1
        ball_1_y_velocity = ball_1_y_velocity * -1
        ball_2_x_velocity = ball_2_x_velocity * -1
        ball_2_y_velocity = ball_2_y_velocity * -1


# This Opens the Graph Window
pythonGraph.open_window(600, 600)

# This is our animation loop
while pythonGraph.window_not_closed():
    # Step 1: Erase Everything on the Screen
    #erase_everything()

    # Step 2: Move the Ball
    move_ball()

    # Step 3: Draw the Ball
    draw_ball()

    # Step 4: Update the Screen
    pythonGraph.update_window()
""" lsn13_examples_3of4.py - example code from lesson 13 """
__author__ = "CS110Z"
import pythonGraph, random

# setup
pythonGraph.open_window(700, 700)

while pythonGraph.window_not_closed():

    # draw a circle at the random corrodinates
    pythonGraph.draw_circle(random.randint(0, 699), random.randint(0, 699),
                            random.randint(10, 70),
                            pythonGraph.create_random_color(), True)

    # if the 's' key is pressed stop the music
    if pythonGraph.key_pressed('s'):
        pythonGraph.stop_music()

    # if 'p' key is pressed play some background music
    if pythonGraph.key_pressed('p'):
        pythonGraph.play_music('my_music.mp3')

    # if the left mouse button is pressed play a sound effect and clear the screen
    if pythonGraph.mouse_button_released(pythonGraph.mouse_buttons.LEFT):
        pythonGraph.play_sound_effect('laser.wav')
        pythonGraph.clear_window(pythonGraph.colors.WHITE)

    # update window
    pythonGraph.update_window()
Example #5
0
SCREEN_HEIGHT = 800

# Gets the number of balls from the user
ball_x = 400
ball_y = 400
ball_x_velocity = 8
ball_y_velocity = -5

# Gets the Number of Times
frame_count = 0

# Animation Flag
animate = False

# Setup tasks for window
pythonGraph.open_window(SCREEN_WIDTH, SCREEN_HEIGHT)
pythonGraph.set_window_title(SCREEN_TITLE)

# Animation Loop
while pythonGraph.window_not_closed():
    pythonGraph.clear_window(pythonGraph.colors.WHITE)

    # Draws Some Text
    pythonGraph.draw_text("# of Times Drawn: " + str(frame_count), 0, 0,
                          pythonGraph.colors.BLACK)

    # Draws the Circle
    pythonGraph.draw_circle(ball_x, ball_y, 35, pythonGraph.colors.RED, True)

    # Toggles Animation Mode
    if pythonGraph.key_pressed('space'):