ok.
1 - use scenes.
2 - this isn't a platformer, you need to know how to code to make a puzzle game, it's not something you can make as your first game.
3 -
KLee10 I tried using chatgpt to help, but it could only do so much.
don't ever ask AI for help with programming. I don't even thrust copilot.
KLee10 I can show more pictures and the scripts to help show where I'm at with it. Any help is appreciated!
yes that is helpful.
4 - you don't seem to know what you are doing. you need to slow down and start over.
5 -
the way I would do a puzzle game is, first thing you need is a matrix for storing the tiles. In godot you need to use an Array
.
here's code I used for accessing the positions using two values of a Vector2i
:
var Voxel_units : Array[int]
var map_size : int = 4
func _ready():
for i in range(map_size):
for j in range(map_size):
Voxel_units.append(0)
#set the tile at position pos by value value
func set_voxel(pos : Vector2i, value : int) -> void:
if len(Voxel_units) > pos.x * pos.y:
Voxel_units[(pos.y * map_size) + (pos.x)] = value
#get the value of tile at position pos
func get_voxel(pos : Vector2i) -> int:
if len(Voxel_units) > pos.x * pos.y:
return Voxel_units[(pos.y * map_size) + (pos.x)]
else:
return Voxel_units[0]
this is an Array of int, each tile would be represented by a number. 0 could be red, 1 could be white, etc.
you can access adjacent tiles with:
var directions : Array[Vector2i] = [Vector2i.DOWN, Vector2i.LEFT, Vector2i.UP, Vector2i.RIGHT]
func check_adjacents(pos : Vector2i) -> Array[Vector2i]:
var arr : Array[Vector2i] = []
for i : Vector2i in directions:
var cpos : Vector2i = pos + i
if cpos.x >= 0 and cpos.x <= TerrainMap.map_size-1 and cpos.y >= 1 and cpos.y <= TerrainMap.map_size-1:
arr.append(cpos)
return arr
then you have to setup visuals by spawning scenes of the card in the positions by shifting them in x and y by using 2 for loops and store them in an array.
this array could be parallel to the one with ints, so you can access the values on one and then change the tile.
this is, again, advanced coding and I can't just think and write all of it as an answer, but it should give you some hints as to how to handle a part of it and point you in the right direction.
I read an entire book on BASIC to learn something like this, I can't just summarize it in a single comment.
there's a lot of problems with your code, you should pay attention to the many warnings (in yellow), and there's code that is just wrong and is causing errors (red). I recommend that you practice with something simpler to learn how to code before jumping into these kind of games. but if you want to continue, start by making the logic part (the matrix), and then we can talk about the visual part, since it's a completely different problem.