Skip to content

Commit

Permalink
Add more features
Browse files Browse the repository at this point in the history
  • Loading branch information
SaturnHafen committed Jan 18, 2024
1 parent 67f00f9 commit 3b00624
Show file tree
Hide file tree
Showing 11 changed files with 492 additions and 40 deletions.
17 changes: 17 additions & 0 deletions prototypes/game-robot-programming/code0.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
extends Node2D


func get_code():
return "main"

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 = areas.filter(func(x: Area2D): return x.position.y > self.get_parent().position.y)

return areas

func is_condition():
return false
6 changes: 6 additions & 0 deletions prototypes/game-robot-programming/code1.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ extends Node2D

func get_code():
return "forward"

func get_stmts():
return []

func is_condition():
return false
5 changes: 4 additions & 1 deletion prototypes/game-robot-programming/code2.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ func get_stmts():

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)
areas = areas.filter(func(x: Area2D): return x.position.y > self.get_parent().position.y)

return areas

func is_condition():
return false
14 changes: 14 additions & 0 deletions prototypes/game-robot-programming/code3.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extends Node2D


func get_code():
return "condition-random"

func get_stmts():
return []

func is_condition():
return true

func check(_robot):
return randi_range(0, 10) < 5
17 changes: 17 additions & 0 deletions prototypes/game-robot-programming/code4.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
extends Node2D


func get_code():
return "if"

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 = areas.filter(func(x: Area2D): return x.position.y > self.get_parent().position.y)

return areas

func is_condition():
return false
11 changes: 11 additions & 0 deletions prototypes/game-robot-programming/code5.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
extends Node2D


func get_code():
return "rotate-left"

func get_stmts():
return []

func is_condition():
return false
14 changes: 14 additions & 0 deletions prototypes/game-robot-programming/code6.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extends Node2D


func get_code():
return "condition-facing"

func get_stmts():
return []

func is_condition():
return true

func check(robot):
return robot.orientation == int($"../TextEdit".text)
Loading

0 comments on commit 3b00624

Please sign in to comment.