Class: Environment

Environment

new Environment()

The object that holds and displays sprites and shapes.
Example
stage = codesters.Environment()

Methods

(static) add_shape(shape)

add_shape(shape) adds a shape to the stage
Parameters:
Name Type Description
shape the shape to add to the stage
Example
stage.add_shape(my_shape)

(static) add_sprite(sprite)

add_sprite(sprite) adds a sprite to the stage
Parameters:
Name Type Description
sprite the sprite to add to the stage
Example
stage.add_sprite(my_sprite)

(static) add_text(text)

add_text(text) adds text to the stage
Parameters:
Name Type Description
text the text to add to the stage
Example
stage.add_text(my_text)

(static) event_click(functionName)

event_click(functionName) calls a function when the mouse is clicked
Parameters:
Name Type Description
functionName the function to call when the mouse is clicked

(static) event_click_down(functionName)

event_click_down(functionName) calls a function when the mouse is pressed down
Parameters:
Name Type Description
functionName the function to call when the mouse is pressed down

(static) event_click_up(functionName)

event_click_up(functionName) calls a function when the mouse is released up
Parameters:
Name Type Description
functionName the function to call when the mouse is released up

(static) event_delay(functionName, seconds)

event_delay(functionName, seconds) calls a function after a certain delay
Parameters:
Name Type Description
functionName the function to call after a certain delay
seconds the number of seconds of delay before calling the function

(static) event_down_key(functionName)

event_down_key(functionName) calls a function when the down key is pressed
Parameters:
Name Type Description
functionName the function to call when the down key is pressed

(static) event_enter_key(functionName)

event_enter_key() sets an function to happen when the enter key is pressed
Parameters:
Name Type Description
functionName function function to happen when the enter key is pressed
Example
def event(sprite){
     #actions
}
stage.event_enter_key(event)

(static) event_forever(functionName)

event_forever(functionName) calls a function to occur forever
Parameters:
Name Type Description
functionName the function to call forever

(static) event_interval(functionName, seconds)

event_interval(functionName, seconds) calls a function to occur repeatedly at a specified interval
Parameters:
Name Type Description
functionName the function to call at a specified interval
seconds the number of seconds to wait between calls of functionName

(static) event_key(keyString, functionName)

event_key(keyString, functionName) calls a function when a is pressed
Parameters:
Name Type Description
keyString the key to be pressed to call a function
functionName the function to call when the left key is pressed

(static) event_left_key(functionName)

event_left_key(functionName) calls a function when the left key is pressed
Parameters:
Name Type Description
functionName the function to call when the left key is pressed

(static) event_mouse_move(functionName)

event_mouse_move(functionName) calls a function when the mouse is moved
Parameters:
Name Type Description
functionName the function to call when the mouse is moved

(static) event_right_key(functionName)

event_right_key(functionName) calls a function when the right key is pressed
Parameters:
Name Type Description
functionName the function to call when the right key is pressed

(static) event_space_key(functionName)

event_space_key(functionName) calls a function when the space key is pressed
Parameters:
Name Type Description
functionName the function to call when the space key is pressed

(static) event_up_key(functionName)

event_up_key(functionName) calls a function when the up key is pressed
Parameters:
Name Type Description
functionName the function to call when the up key is pressed

(static) move_down(amount)

move_down(amount) moves the background down by a certain amount
Parameters:
Name Type Description
amount the amount by which the background should move down

(static) move_left(amount)

move_left(amount) moves the background to the left by a certain amount
Parameters:
Name Type Description
amount the amount by which the background should move to the left

(static) move_right(amount)

move_right(amount) moves the background to the right by a certain amount
Parameters:
Name Type Description
amount the amount by which the background should move to the right

(static) move_up(amount)

move_up(amount) moves the background up by a certain amount
Parameters:
Name Type Description
amount the amount by which the background should move up

(static) remove_shape(shape)

remove_shape(shape) removes a shape from the stage
Parameters:
Name Type Description
shape the shape to remove from the stage
Example
stage.remove_shape(my_shape)

(static) remove_sprite(sprite)

remove_sprite(sprite) removes a sprite from the stage
Parameters:
Name Type Description
sprite the sprite to remove from the stage
Example
stage.remove_sprite(my_sprite)

(static) remove_text(text)

remove_text(text) removes text from the stage
Parameters:
Name Type Description
text the text to remove from the stage
Example
stage.remove_text(my_text)

(static) set_background(background_name)

set_background(background_name) sets the background
Parameters:
Name Type Description
background_name the name of the desired background

(static) set_background_scale(amount)

set_background_scale(amount) scales the background
Parameters:
Name Type Description
amount the desired relative size of the background

(static) set_background_scaleX(amount)

set_background_scaleX(amount) scales the background in the x direction
Parameters:
Name Type Description
amount the desired relative size of the background in the x direction

(static) set_background_scaleY(amount)

set_background_scaleY(amount) scales the background in the y direction
Parameters:
Name Type Description
amount the desired relative size of the background in the y direction

(static) set_background_x(x)

set_background_x(x) sets the x coordinate of the background
Parameters:
Name Type Description
x the desired x coordinate of the background

(static) set_background_y(y)

set_background_y(y) sets the y coordinate of the background
Parameters:
Name Type Description
y the desired y coordinate of the background

(static) test_sprite()

test_sprite() creates a test sprite
Example
stage.test_sprite(my_sprite)