Exemple #1
0
def test_window(twm):
    import arcade
    width = 800
    height = 600
    title = "My Title"
    resizable = True
    arcade.open_window(width, height, title, resizable)

    arcade.set_background_color(arcade.color.AMAZON)
    w = arcade.get_window()
    assert w is not None

    # Make sure the arguments get passed to the window
    if not twm:
        assert w.width == width
        assert w.height == height
    assert w.caption == title
    assert w.resizeable is resizable
    assert w.current_view is None

    arcade.set_window(w)

    w.background_color = 255, 255, 255, 255
    assert w.background_color == (255, 255, 255, 255)
    w.set_mouse_visible(True)
    w.set_size(width, height)

    p = arcade.get_projection()
    assert isinstance(p, np.ndarray)

    v = arcade.get_viewport()
    if not twm:
        assert v[0] == 0
        # The lines below fail. Why?
        assert v[1] == width - 1
        assert v[2] == 0
        assert v[3] == height - 1

    factor = arcade.get_scaling_factor()
    assert factor > 0
    factor = arcade.get_scaling_factor(w)
    assert factor > 0

    arcade.start_render()
    arcade.finish_render()

    def f():
        pass

    arcade.schedule(f, 1 / 60)

    arcade.pause(0.01)

    arcade.close_window()

    arcade.open_window(width, height, title, resizable)
    arcade.quick_run(0.01)
Exemple #2
0
    def on_key_press(self, key, modifiers):  # 키가 눌렸을 때
        # 키가 눌리면 호출됨

        #눌렸으면 상태롤 True 로 변경
        if self.check_game == True:
            if key == arcade.key.UP or key == arcade.key.W:
                self.up_pressed = True
            elif key == arcade.key.DOWN or key == arcade.key.S:
                self.down_pressed = True
            elif key == arcade.key.LEFT or key == arcade.key.A:
                self.left_pressed = True
            elif key == arcade.key.RIGHT or key == arcade.key.D:
                self.right_pressed = True
            elif key == arcade.key.O:
                arcade.pause(1)
            elif key == arcade.key.P:
                arcade.quick_run(5)
            self.process_keychange()
Exemple #3
0
def test_window():
    import arcade
    width = 800
    height = 600
    title = "My Title"
    resizable = True
    arcade.open_window(width, height, title, resizable)

    arcade.set_background_color(arcade.color.AMAZON)
    w = arcade.get_window()
    assert w is not None

    # Make sure the arguments get passed to the window
    assert w.width == width
    assert w.height == height
    assert w.caption == title
    assert w.resizeable is resizable

    arcade.set_window(w)

    p = arcade.get_projection()
    assert p is not None

    v = arcade.get_viewport()
    assert v[0] == 0
    # The lines below fail. Why?
    # assert v[1] == width - 1
    assert v[2] == 0
    # assert v[3] == height - 1

    arcade.start_render()
    arcade.finish_render()

    def f():
        pass

    arcade.schedule(f, 1 / 60)

    arcade.pause(0.01)

    arcade.close_window()

    arcade.open_window(width, height, title, resizable)
    arcade.quick_run(0.01)
Exemple #4
0
	def update(self,delta_time):
		if int(self.total_time)==0:
			self.game_over=True
		if not(self.game_over):
			self.total_time-=delta_time
			
			self.all_sprites_list.update()
			self.physics_engine.update()
			
			bier_hit_list = arcade.check_for_collision_with_list(self.player_sprite,self.bier_list)
			secu_hit_list = arcade.check_for_collision_with_list(self.player_sprite,self.secu_list)

			for bier in bier_hit_list:
				bier.kill()
				self.score+=1

			if len(secu_hit_list)>0 :
				self.game_over=True
		else : 
			arcade.quick_run(0.25)
def test_window():
    import arcade
    width = 800
    height = 600
    title = "My Title"
    resizable = True
    arcade.open_window(width, height, title, resizable)

    arcade.set_background_color(arcade.color.AMAZON)
    w = arcade.get_window()
    assert w is not None
    arcade.set_window(w)

    p = arcade.get_projection()
    assert p is not None

    v = arcade.get_viewport()
    assert v[0] == 0
    assert v[1] == width - 1
    assert v[2] == 0
    assert v[3] == height - 1

    arcade.start_render()
    arcade.finish_render()

    def f():
        pass

    arcade.schedule(f, 1 / 60)

    arcade.pause(0.01)

    arcade.close_window()

    arcade.open_window(width, height, title, resizable)
    arcade.quick_run(0.01)
#!/usr/bin/env python3
import arcade
arcade.open_window(800, 600, "Drawing Example")
arcade.set_background_color(arcade.color.RED)
arcade.start_render()

# All the drawing commands go here
my_text = arcade.create_text("Text Example", arcade.color.BLACK, 10)
arcade.render_text(my_text, 250, 300, 45)

arcade.finish_render()
arcade.quick_run(2.5)
Exemple #7
0
player.update()
player.face_left()
player.update()
player.change_x = -10 #Left
player.change_y = 0.0
player.update()
player.go_left()
player.update()
player.update()
player.update()
player.stop_left()
player.update()
player.face_right()
player.change_x = 10 # Right
player.change_y = 0.0
print("Ping")
player.update()
player.go_right()
player.update()
player.update()
player.update()
player.stop_right()
player.update()
player.stop_right()
player.change_x = 0 # Stop
player.change_y = 0.0
player.update()
player.update()
player.kill()
arcade.quick_run(0.25)
Exemple #8
0
# Exploring arcade library
# http://arcade.academy/quick_index.html

import arcade

arcade.open_window(800, 600, "Text Example")
arcade.set_background_color(arcade.color.RED)
arcade.start_render()
text = arcade.create_text("Text example", arcade.color.GREEN, 14, bold=True)
arcade.render_text(text, 250, 300, 30)

arcade.draw_text("Text Example", 250, 300, arcade.color.BLACK, 10)

arcade.finish_render()
arcade.quick_run(5)

import arcade

arcade.open_window(800, 600, "Arcs Example")
arcade.set_background_color(arcade.color.RED)
arcade.start_render()
arcade.draw_arc_filled(100, 200, 50, 50, arcade.color.YELLOW, 0, 270, 45)
arcade.draw_arc_outline(200, 200, 50, 50, arcade.color.YELLOW, 45, 315)
arcade.draw_arc_filled(150, 144, 15, 36, arcade.color.BOTTLE_GREEN, 90, 360,
                       45)
arcade.draw_arc_filled(150, 154, 15, 36, (255, 0, 0, 127), 90, 360, 45)
arcade.draw_arc_outline(150, 81, 15, 36, arcade.color.BRIGHT_MAROON, 90, 360)
transparent_color = (255, 0, 0, 127)
arcade.draw_arc_outline(150, 71, 15, 36, transparent_color, 90, 360)
arcade.render_text(text, 250, 300, 30)
arcade.finish_render()