-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add first robot programming iteration
- Loading branch information
1 parent
333f2fc
commit 67f00f9
Showing
10 changed files
with
450 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extends Node2D | ||
|
||
|
||
func get_code(): | ||
return "forward" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
extends Node2D | ||
|
||
|
||
func get_code(): | ||
return "while" | ||
|
||
func get_stmts(): | ||
var areas = self.get_parent().get_overlapping_areas() | ||
|
||
areas.sort_custom(func (a: Area2D, b: Area2D): return a.position.y < b.position.y) | ||
|
||
areas.filter(func(x: Area2D): return x.position.y > self.get_parent().position.y) | ||
|
||
return areas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
extends Area2D | ||
|
||
var dragging: bool = false | ||
|
||
signal dragsignal | ||
|
||
|
||
# Called when the node enters the scene tree for the first time. | ||
func _ready(): | ||
dragsignal.connect(self._set_drag_pc) | ||
|
||
|
||
# Called every frame. 'delta' is the elapsed time since the previous frame. | ||
func _process(delta): | ||
if dragging: | ||
var mousepos = get_viewport().get_mouse_position() | ||
self.position = mousepos | ||
|
||
func _set_drag_pc(): | ||
dragging = !dragging | ||
|
||
func _on_input_event(viewport, event, shape_idx): | ||
print("Input event") | ||
if event is InputEventMouseButton: | ||
if event.button_index == MOUSE_BUTTON_LEFT and event.pressed: | ||
dragsignal.emit() | ||
elif event.button_index == MOUSE_BUTTON_LEFT and !event.pressed: | ||
dragsignal.emit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
extends Button | ||
|
||
func enlarge(): | ||
$"../CollisionShape2D".shape.size.y += 10 | ||
$"../CollisionShape2D".position.y += 5 | ||
$"../Polygon2D".polygon[0].y += 10 | ||
$"../Polygon2D".polygon[3].y += 10 |
Oops, something went wrong.