I am doing my first game in Godot without following tutorials (to challenge myself) as this is my first approach to programming and gaming i apologize if i provide not enough or too much information.
I want to do a hidden object game through several rooms (scenes) and need to have certain items or had a certain conversation in order to unlock the next steps.
For now, I have managed to create the layout, add the items and have an ItemList showing the items that hide from the scene by saving the data on the PC.
Considering they are 24 objects to pick on 8 room (considering 3 per room) I would like people to be able to collect only 1 or 2 per room before exploring the others.
On my Global script,
I have a variable with all the "Game_Objects" that are pickable.
var Game_Objects = [ "Cane",
"Doc Coat",
"Empty Jar",
"Filter Jar",
"Firefly",
"Game Piece 1",
"Game Piece 2",
"Game Piece 3",
"Glow Jar",
"Glow Jar Fireflies",
"Gold",
"Ingredient A",
"Ingredient B",
"Ingredient C",
"Ingredient D",
"Ingredient E",
"Jar Blue Filter",
"Loaf Bread",
"Mandolin String",
"Medallion",
"Potato",
"Potion",
"Recipie",
"Ring",
"Rock",
"Scroll",
"Soup",
"Urine"]
I also added a "Collected Objects" array inside a variable called Data
var Data = {
"Collected Objects": [],
In each room, I call this array to collect the item, add it to the ItemList and hide it from the room.
Now I am trying to hide the items until an event happens (you collect an item or you speak to someone).
I manage to hide the item creating a function on each room
func hide_object(name):
var Soup = $Soup
Soup.visible = false
and it works to permanently hide it, i want it to work with interaction. i decided to use the "for" option (not sure if it is the correct way) which gives me an error
Code used:
func hide_object(name):
var Soup = $Soup
Soup.visible = false
for Cane in Global.Data["Collected Objects"]:
if Global.Data["Collected Objects"][Cane] == true:
Soup.visible = true
else:
Soup.visible = false
And the error that gives me

I am not sure if this is the best way to implement if this method or not. and i find myself a bit lost since some days on this.
Found a solution that works for items.
func hide_object(name):
var Soup = $Soup
Soup.visible = false
if Global.Data["Collected Objects"]:
for item in Global.Data["Collected Objects"]:
if "Cane" in item:
Soup.visible = true
Now i will need to try it with speaking with characters.
I keep the post on as is my first one and maybe someone has a better approach that i can use instead of adding each per room :smile: