summaryrefslogtreecommitdiff
path: root/demos/3d/mousepick_test/mousepick.gd
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2015-12-09 08:38:23 +0100
committerRémi Verschelde <rverschelde@gmail.com>2015-12-09 08:38:23 +0100
commit8639cecf4cedd56452b47503be19c44b304cd02f (patch)
treee2a795da15e40c7d9d5b82e33378f8dbf0eaf67a /demos/3d/mousepick_test/mousepick.gd
parentefbb834936fdc9da9789ad37c9cc61e0b90cda95 (diff)
Improve code formatting and update to 2.0
The scripts were streamlined using more or less the following conventions: - space after a comma in lists of arguments - space around weak operators (+, -), no space around strong 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 The scene files were resaved with the (current) 2.0 format, and some scenes that were in XML format were converted to SCN, to be consistent across all demos.
Diffstat (limited to 'demos/3d/mousepick_test/mousepick.gd')
-rw-r--r--demos/3d/mousepick_test/mousepick.gd22
1 files changed, 7 insertions, 15 deletions
diff --git a/demos/3d/mousepick_test/mousepick.gd b/demos/3d/mousepick_test/mousepick.gd
index c96091b650..c250c7f084 100644
--- a/demos/3d/mousepick_test/mousepick.gd
+++ b/demos/3d/mousepick_test/mousepick.gd
@@ -1,15 +1,12 @@
extends RigidBody
-# member variables here, example:
-# var a=2
-# var b="textvar"
-
+# member variables
var gray_mat = FixedMaterial.new()
-
var selected=false
-func _input_event(camera,event,pos,normal,shape):
+
+func _input_event(camera, event, pos, normal, shape):
if (event.type==InputEvent.MOUSE_BUTTON and event.pressed):
if (not selected):
get_node("mesh").set_material_override(gray_mat)
@@ -17,16 +14,11 @@ func _input_event(camera,event,pos,normal,shape):
get_node("mesh").set_material_override(null)
selected = not selected
-
-func _mouse_enter():
- get_node("mesh").set_scale( Vector3(1.1,1.1,1.1) )
-func _mouse_exit():
- get_node("mesh").set_scale( Vector3(1,1,1) )
-
-func _ready():
- # Initalization here
- pass
+func _mouse_enter():
+ get_node("mesh").set_scale(Vector3(1.1, 1.1, 1.1))
+func _mouse_exit():
+ get_node("mesh").set_scale(Vector3(1, 1, 1))