Attempt at adding multiple textures for the playfield squares

In the end, I've disabled the functionality since  I didn't think it made an improvement.

It might be interesting if there was a larger texture overlayed over all the squares so that it feels cohesive.
This commit is contained in:
Kienan Stewart 2022-04-03 19:54:43 -04:00
parent b154bed9bf
commit e08c9ae05f
8 changed files with 32 additions and 11 deletions

View File

@ -1,13 +1,11 @@
1. Visual polish
* multiple square tiles to add variation
2. Sound effects
1. Sound effects
* when a unit is killed
* if possible, a small bit of background music
3. Gameplay additions:
2. Gameplay additions:
* powerups: change movement type, remove pawn's attack and movement restrictions
* new units
* choose difference board sizes
4. Further visual polish
3. Further visual polish
* animate the piece making the attack, and returning to it's spot
Bugs of note:

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

View File

@ -239,10 +239,12 @@ func set_piece_position(piece, position, destroy = false):
# Called when the node enters the scene tree for the first time.
func _ready():
self.rng = RandomNumberGenerator.new()
self.rng.randomize()
var pf = get_node("/root/Game/MarginContainer/Playfield")
var start_height = 8
var start_width = 8
pf.initialize(start_width, start_height)
pf.initialize(start_width, start_height, self.rng)
self.height = start_height
self.width = start_width
# Translate the pf to it sits on top left
@ -260,9 +262,6 @@ func _ready():
64 * scale
))
self.pf_scale = scale
self.rng = RandomNumberGenerator.new()
self.rng.randomize()
get_node("/root/Game/EndMenu/VBoxContainer/New").connect("pressed", self, "_on_new_game_pressed")
get_node("/root/Game/EndMenu/VBoxContainer/Quit").connect("pressed", self, "_on_quit_game_pressed")
get_node("/root/Game/EndMenu/VBoxContainer/Fail Game").connect("pressed", self, "_on_fail_game")

View File

@ -10,7 +10,14 @@ var width
# holds weakrefs to the square nodes
var squares = {}
func initialize(width: int = 8, height: int = 8):
const TILES = [
"Body",
"Body1",
"Body2",
]
func initialize(width: int = 8, height: int = 8, rng = null):
rng = null
# Remove any Squares beneath us
for i in self.squares.values():
if i.get_ref():
@ -26,6 +33,11 @@ func initialize(width: int = 8, height: int = 8):
var j = 0
while j < self.height:
var instance = ResourceLoader.load("res://src/Square.tscn").instance()
if rng == null:
instance.get_node("Body").set_visible(true)
else:
var n = rng.randi() % TILES.size()
instance.get_node(TILES[n]).set_visible(true)
# @TODO any tweaks to the node by calling custom function initialize()
instance.translate(Vector2(128*i, 128*j))
self.squares[Vector2(i, j)] = weakref(instance)

View File

@ -12,6 +12,7 @@ const FLASH_MIN = Color(1, 0.75, 0.75, 1)
const FLASH_MAX = Color(1, 0.5, 0.5, 1)
const DEFAULT_BODY = Color(1, 1, 1, 1)
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.

View File

@ -1,8 +1,10 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://assets/export/edge.png" type="Texture" id=1]
[ext_resource path="res://assets/export/square_center_0.png" type="Texture" id=2]
[ext_resource path="res://src/Square.gd" type="Script" id=3]
[ext_resource path="res://assets/export/square_center_2.png" type="Texture" id=4]
[ext_resource path="res://assets/export/square_center_1.png" type="Texture" id=5]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 60, 60 )
@ -12,8 +14,17 @@ z_index = -1
script = ExtResource( 3 )
[node name="Body" type="Sprite" parent="."]
visible = false
texture = ExtResource( 2 )
[node name="Body1" type="Sprite" parent="."]
visible = false
texture = ExtResource( 5 )
[node name="Body2" type="Sprite" parent="."]
visible = false
texture = ExtResource( 4 )
[node name="Edge" type="Sprite" parent="."]
modulate = Color( 0.12549, 0.0980392, 0.0980392, 1 )
texture = ExtResource( 1 )