Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main/assets/change_scene.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ extends Node

var games = {
"checkers": "res://checkers/checkers.tscn",
"chess": "res://chess/chess.tscn",
"connect": "res://connect/connect.tscn",
"basketball": "res://basketball/basketball.tscn",
"sea": "res://battleship/battleship.tscn",
Expand Down
2,118 changes: 2,118 additions & 0 deletions app/src/main/assets/chess/chess.gd

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/src/main/assets/chess/chess.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://c2tucuh4qvd1y
106 changes: 106 additions & 0 deletions app/src/main/assets/chess/chess.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
[gd_scene load_steps=5 format=3 uid="uid://b8lajx2v3mn4p"]

[ext_resource type="Script" uid="uid://c2tucuh4qvd1y" path="res://chess/chess.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://c5vnqtru5m53v" path="res://chess/pieces/chess_wK.png" id="2_wk"]
[ext_resource type="Texture2D" uid="uid://bssq5dvr0wpwb" path="res://chess/pieces/chess_bK.png" id="3_bk"]

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4qhse"]
bg_color = Color(0.545098, 0.545098, 0.545098, 0.72549)
corner_radius_top_left = 25
corner_radius_top_right = 25
corner_radius_bottom_right = 25
corner_radius_bottom_left = 25

[node name="Chess" type="Node2D"]
script = ExtResource("1")

[node name="Player1Box" type="Panel" parent="."]
top_level = true
offset_left = 413.0
offset_top = 36.0
offset_right = 559.0
offset_bottom = 193.0
theme_override_styles/panel = SubResource("StyleBoxFlat_4qhse")

[node name="P1Label" type="RichTextLabel" parent="Player1Box"]
layout_mode = 0
offset_left = 1.0
offset_top = 90.2499
offset_right = 148.0
offset_bottom = 138.25
theme_override_font_sizes/normal_font_size = 30
bbcode_enabled = true
text = "[center]Player 2[/center]"

[node name="PlayerChessBlack" type="Sprite2D" parent="Player1Box"]
position = Vector2(74, 45.25)
texture = ExtResource("3_bk")

[node name="Player2Box" type="Panel" parent="."]
top_level = true
offset_left = 87.0
offset_top = 36.0
offset_right = 233.0
offset_bottom = 193.0
theme_override_styles/panel = SubResource("StyleBoxFlat_4qhse")

[node name="P2Label" type="RichTextLabel" parent="Player2Box"]
layout_mode = 0
offset_left = 1.0
offset_top = 90.2499
offset_right = 148.0
offset_bottom = 138.25
theme_override_font_sizes/normal_font_size = 30
bbcode_enabled = true
text = "[center]Player 1[/center]"

[node name="PlayerChessWhite" type="Sprite2D" parent="Player2Box"]
position = Vector2(74, 45.25)
texture = ExtResource("2_wk")

[node name="waitingLabel" type="Panel" parent="."]
visible = false
top_level = true
offset_left = 116.0
offset_top = 609.0
offset_right = 546.0
offset_bottom = 709.0
theme_override_styles/panel = SubResource("StyleBoxFlat_4qhse")

[node name="RichTextLabel" type="RichTextLabel" parent="waitingLabel"]
layout_mode = 0
offset_left = 14.0
offset_top = 29.2222
offset_right = 417.0
offset_bottom = 71.2222
theme_override_font_sizes/normal_font_size = 30
bbcode_enabled = true
text = "[center]WAITING FOR OPPONENT...[/center]"

[node name="winLoseLabel" type="Panel" parent="."]
visible = false
top_level = true
offset_left = 116.0
offset_top = 609.0
offset_right = 546.0
offset_bottom = 709.0
theme_override_styles/panel = SubResource("StyleBoxFlat_4qhse")

[node name="RichTextLabel" type="RichTextLabel" parent="winLoseLabel"]
layout_mode = 0
offset_left = 16.0
offset_top = 29.2222
offset_right = 419.0
offset_bottom = 71.2222
theme_override_font_sizes/normal_font_size = 30
bbcode_enabled = true
text = "[center]YOU WIN![/center]"

[node name="SendButton" type="Button" parent="."]
offset_left = 112.0
offset_top = 1068.0
offset_right = 232.0
offset_bottom = 1118.0
disabled = true
text = "Send
"
Binary file added app/src/main/assets/chess/pieces/chess_bB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/chess/pieces/chess_bK.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/chess/pieces/chess_bN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/chess/pieces/chess_bP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/chess/pieces/chess_bQ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/chess/pieces/chess_bR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/chess/pieces/chess_wB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/chess/pieces/chess_wK.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/chess/pieces/chess_wN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/chess/pieces/chess_wP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/chess/pieces/chess_wQ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/chess/pieces/chess_wR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion app/src/main/assets/game_picker.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
extends Control

var games = {
var games: Dictionary = {
"checkers": "res://checkers/checkers.tscn",
"chess": "res://chess/chess.tscn",
"connect": "res://connect/connect.tscn",
"basketball": "res://basketball/basketball.tscn",
"sea": "res://battleship/battleship.tscn",
Expand All @@ -28,6 +29,8 @@ func _ready() -> void:
func _pressed() -> void:
if name == "CheckersButton":
get_tree().call_deferred("change_scene_to_file", games["checkers"])
elif name == "ChessButton":
get_tree().call_deferred("change_scene_to_file", games["chess"])
elif name == "ConnectFourButton":
get_tree().call_deferred("change_scene_to_file", games["connect"])
elif name == "BasketballButton":
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/assets/game_picker.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,12 @@ offset_bottom = 784.0
text = "Mancala
"
script = ExtResource("1_4r7pt")

[node name="ChessButton" type="Button" parent="."]
layout_mode = 0
offset_left = 143.0
offset_top = 723.0
offset_right = 489.0
offset_bottom = 784.0
text = "Chess"
script = ExtResource("1_4r7pt")
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import com.openbubbles.openpigeon.archery.ArcheryGame
import com.openbubbles.openpigeon.basketball.BasketballGame
import com.openbubbles.openpigeon.battleship.BattleshipGame
import com.openbubbles.openpigeon.checkers.CheckersGame
import com.openbubbles.openpigeon.chess.ChessGame
import com.openbubbles.openpigeon.connect.ConnectGame
import com.openbubbles.openpigeon.crazy8.Crazy8Game
import com.openbubbles.openpigeon.darts.DartsGame
Expand Down Expand Up @@ -87,6 +88,7 @@ class MadridExtension(val context: Context) : IMadridExtension.Stub() {

val games: List<Game> = listOf(
CheckersGame(),
ChessGame(),
WordHuntGame(),
ConnectGame(),
BasketballGame(),
Expand Down
35 changes: 35 additions & 0 deletions app/src/main/java/com/openbubbles/openpigeon/chess/ChessGame.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.openbubbles.openpigeon.chess

import android.content.Context
import com.openbubbles.openpigeon.Game
import com.openbubbles.openpigeon.R
import com.openbubbles.openpigeon.godot.GodotGameActivity

class ChessGame : Game {
override fun getVersion(): String = "1"
override fun getName(): String = "chess"
override fun displayName(): String = "Chess"

override fun gameClass(): Class<*> = GodotGameActivity::class.java

// Use a dedicated chess icon drawable for the poster shown in pickers/menus.
override fun gamePoster(config: Map<String, String>?): Int = R.drawable.chess

override fun getNewGameData(context: Context): MutableMap<String, String> {
return super.getNewGameData(context).apply {
put("replay", getDefaultReplay())
}
}

override fun getDefaultReplay(): String {
// Initial chess position in GamePigeon format
// Board representation: 64-element flat array (index = file + rank*8)
// Piece encoding: 0=empty, white: 11=P,12=R,13=N,14=B,15=Q,16=K, black: 21=P,22=R,23=N,24=B,25=Q,26=K
// Rank 1: white back row (R,N,B,Q,K,B,N,R)
// Rank 2: white pawns
// Ranks 3-6: empty
// Rank 7: black pawns
// Rank 8: black back row (r,n,b,q,k,b,n,r)
return "board:12,13,14,15,16,14,13,12,11,11,11,11,11,11,11,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,21,21,21,21,21,21,21,22,23,24,25,26,24,23,22"
}
}
Binary file added app/src/main/res/drawable/chess.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.