Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Go Save The King
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Htoo Aung (kha451)
Go Save The King
Commits
db4c7ba0
"SchedulerApp/target/classes" did not exist on "e897c70bb8b68eb309bb5bc083a72319ad4213e5"
Commit
db4c7ba0
authored
1 month ago
by
Alan
Browse files
Options
Downloads
Patches
Plain Diff
Added upgrade for rook
parent
16fe7e12
No related branches found
No related tags found
1 merge request
!1
Refactoring game.gd to split up move validation to individual pieces, added...
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.godot/editor/script_editor_cache.cfg
+8
-4
8 additions, 4 deletions
.godot/editor/script_editor_cache.cfg
scripts/Pawn.gd
+2
-2
2 additions, 2 deletions
scripts/Pawn.gd
scripts/Rook.gd
+13
-0
13 additions, 0 deletions
scripts/Rook.gd
with
23 additions
and
6 deletions
.godot/editor/script_editor_cache.cfg
+
8
−
4
View file @
db4c7ba0
...
@@ -45,11 +45,15 @@ state={
...
@@ -45,11 +45,15 @@ state={
state
=
{
state
=
{
"bookmarks":
PackedInt32Array(),
"bookmarks":
PackedInt32Array(),
"breakpoints":
PackedInt32Array(),
"breakpoints":
PackedInt32Array(),
"column":
36
,
"column":
0
,
"folded_lines":
Array
[int]
(
[]
),
"folded_lines":
Array
[int]
(
[]
),
"h_scroll_position":
0,
"h_scroll_position":
0,
"row":
52,
"row":
10,
"scroll_position":
39.0,
"scroll_position":
0.0,
"selection":
false,
"selection":
true,
"selection_from_column":
0,
"selection_from_line":
10,
"selection_to_column":
43,
"selection_to_line":
10,
"syntax_highlighter":
"GDScript"
"syntax_highlighter":
"GDScript"
}
}
This diff is collapsed.
Click to expand it.
scripts/Pawn.gd
+
2
−
2
View file @
db4c7ba0
...
@@ -7,8 +7,8 @@ enum Upgrade { DOUBLE_MOVE, DIAGONAL_MOVE }
...
@@ -7,8 +7,8 @@ enum Upgrade { DOUBLE_MOVE, DIAGONAL_MOVE }
func
_init
(
is_white
:
bool
,
position
:
Vector2
):
func
_init
(
is_white
:
bool
,
position
:
Vector2
):
super
.
_init
(
is_white
,
position
)
super
.
_init
(
is_white
,
position
)
# Testing upgrades
# Testing upgrades
upgrades
.
append
(
Upgrade
.
DOUBLE_MOVE
)
#
upgrades.append(Upgrade.DOUBLE_MOVE)
upgrades
.
append
(
Upgrade
.
DIAGONAL_MOVE
)
#
upgrades.append(Upgrade.DIAGONAL_MOVE)
func
get_valid_moves
(
board_state
:
Array
,
pos
:
Vector2
)
->
Array
[
Vector2
]:
func
get_valid_moves
(
board_state
:
Array
,
pos
:
Vector2
)
->
Array
[
Vector2
]:
...
...
This diff is collapsed.
Click to expand it.
scripts/Rook.gd
+
13
−
0
View file @
db4c7ba0
...
@@ -8,6 +8,8 @@ enum Upgrade {
...
@@ -8,6 +8,8 @@ enum Upgrade {
func
_init
(
is_white
:
bool
,
position
:
Vector2
):
func
_init
(
is_white
:
bool
,
position
:
Vector2
):
super
.
_init
(
is_white
,
position
)
super
.
_init
(
is_white
,
position
)
# Testing upgrades
# upgrades.append(Upgrade.DIAGONAL_MOVE_ONE)
func
get_valid_moves
(
board_state
:
Array
,
pos
:
Vector2
)
->
Array
[
Vector2
]:
func
get_valid_moves
(
board_state
:
Array
,
pos
:
Vector2
)
->
Array
[
Vector2
]:
var
valid_moves
:
Array
[
Vector2
]
=
[]
var
valid_moves
:
Array
[
Vector2
]
=
[]
...
@@ -57,5 +59,16 @@ func get_valid_moves(board_state: Array, pos: Vector2) -> Array[Vector2]:
...
@@ -57,5 +59,16 @@ func get_valid_moves(board_state: Array, pos: Vector2) -> Array[Vector2]:
break
break
else
:
else
:
break
break
# Check for DIAGONAL_MOVE_ONE upgrade
if
Upgrade
.
DIAGONAL_MOVE_ONE
in
upgrades
:
if
x
>
0
and
y
>
0
and
(
board_state
[
x
-
1
][
y
-
1
]
==
null
or
not
board_state
[
x
-
1
][
y
-
1
]
.
is_white
):
valid_moves
.
append
(
Vector2
(
x
-
1
,
y
-
1
))
if
x
<
7
and
y
>
0
and
(
board_state
[
x
+
1
][
y
-
1
]
==
null
or
not
board_state
[
x
+
1
][
y
-
1
]
.
is_white
):
valid_moves
.
append
(
Vector2
(
x
+
1
,
y
-
1
))
if
x
>
0
and
y
<
7
and
(
board_state
[
x
-
1
][
y
+
1
]
==
null
or
not
board_state
[
x
-
1
][
y
+
1
]
.
is_white
):
valid_moves
.
append
(
Vector2
(
x
-
1
,
y
+
1
))
if
x
<
7
and
y
<
7
and
(
board_state
[
x
+
1
][
y
+
1
]
==
null
or
not
board_state
[
x
+
1
][
y
+
1
]
.
is_white
):
valid_moves
.
append
(
Vector2
(
x
+
1
,
y
+
1
))
return
valid_moves
return
valid_moves
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment