slayer_in_the_shadows.game_view#

Game View

Module Contents#

Classes#

GameView

Main application class.

Functions#

entity_dist(→ float)

Returns distance between the two entities

entity_angle(→ float)

Returns angle from entity_1 to entity_2

class slayer_in_the_shadows.game_view.GameView[source]#

Bases: arcade.View

Main application class.

on_show_view()[source]#

Called once when the view is shown.

See also

on_hide_view()

setup()[source]#

Set up the game here. Call this function to restart the game.

add_enemy(enemy)[source]#

Adds enemy to physics engine

on_draw()[source]#

Render the screen.

update_player_speed()[source]#

Calculate speed based on the keys pressed

on_key_press(symbol, modifiers)[source]#

Called whenever a key is pressed.

on_key_release(key, modifiers)[source]#

Called when the user releases a key.

center_camera_to_player()[source]#

Centers the camera to the player

update_enemies()[source]#

Updates enemies

on_update(delta_time)[source]#

Movement and game logic

on_mouse_press(x: int, y: int, button: int, modifiers: int)[source]#

Override this function to add mouse button functionality.

Parameters:
  • x (int) – x position of the mouse

  • y (int) – y position of the mouse

  • button (int) – What button was hit. One of: arcade.MOUSE_BUTTON_LEFT, arcade.MOUSE_BUTTON_RIGHT, arcade.MOUSE_BUTTON_MIDDLE

  • modifiers (int) – Bitwise ‘and’ of all modifiers (shift, ctrl, num lock) pressed during this event. See keyboard_modifiers.

on_mouse_release(x: int, y: int, button: int, modifiers: int)[source]#

Override this function to add mouse button functionality.

Parameters:
  • x (int) – x position of mouse

  • y (int) – y position of mouse

  • button (int) – What button was hit. One of: arcade.MOUSE_BUTTON_LEFT, arcade.MOUSE_BUTTON_RIGHT, arcade.MOUSE_BUTTON_MIDDLE

  • modifiers (int) – Bitwise ‘and’ of all modifiers (shift, ctrl, num lock) pressed during this event. See keyboard_modifiers.

on_resize(width, height)[source]#

Resize window

find_enemies_in_range()[source]#

Returns a list of all enemies in range of player’s attack

perform_attack(attack: slayer_in_the_shadows.sprites.attacks.AttackSpec)[source]#

ATTACK

kill_enemy(enemy)[source]#

Called when enemy dies

slayer_in_the_shadows.game_view.entity_dist(entity_1, entity_2) float[source]#

Returns distance between the two entities

slayer_in_the_shadows.game_view.entity_angle(entity_1, entity_2) float[source]#

Returns angle from entity_1 to entity_2