virtualx-engine/demos/2d/shower_of_bullets/shower.gd
Rémi Verschelde 7589b2bf60 Improve code formatting
The scripts were streamlined using more or less the following conventions:
 - space after a comma in lists of arguments
 - spaces around weak operators (+, -), no spaces around strong operators (*, /)
 - spaces around comparison operators and compound assignment operators
 - space after a comment start (#)
 - removed trailing spaces or tabs, apart from those that delimit the function indentation level (those could be removed too but since they are added automatically by the editor when typing code, keeping them for now)
 - function blocks separate by two newlines
 - comment sentences start with an upper-case letter
2015-12-09 08:39:12 +01:00

26 lines
544 B
GDScript

extends Node2D
# Member variables
var touching = 0
func _input(event):
if (event.type == InputEvent.MOUSE_MOTION):
get_node("player").set_pos(event.pos - Vector2(0, 16))
func _on_player_body_enter_shape(body_id, body, body_shape, area_shape):
touching += 1
if (touching == 1):
get_node("player/sprite").set_frame(1)
func _on_player_body_exit_shape(body_id, body, body_shape, area_shape):
touching -= 1
if (touching == 0):
get_node("player/sprite").set_frame(0)
func _ready():
# Initialization here
set_process_input(true)