Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Hi everyone! (getting tired of me yet?) Been banging my head against what I feel like should be a simple problem but I can't figure it out.

Basically, I'm trying to make it so that when the player clicks on a coin, it gets destroyed and adds one to their coin counter. As of right now, I have a contraption that has an image and a field to hold this data (this part works as intended). When I use the listener to change the value, it works as intended, but not when called by the deck script. I have another contraption send a "coin_pickup" event to the deck, and the deck catches it and opens a dialogue box (this part works). But it is not changing the value of the coin counter after.

What's the way that I should be doing this?

Hopefully that made sense. Here's the deck code:

on coin_pickup do
 dd.open[deck ddstyle]
 dd.say["you found a coin."]
 dd.close[deck]
 coins.value:coins.value+1
end
(+1)

It's a delight to help a project come together, don't worry. :)

This may be an incomplete answer but the first thing that stood out to me is that you need to give the "full address" of a widget, when you're referring to it in the deck-level script. Like this:

aspecificcardname.widgets.coins.value

Though you can also make it easier to write by defining a shortcut for that full path in the deck-level script and then using that shortcut:

coins:aspecificcardname.widgets.coins 
coins.value:coins.value+1 

(You may have set something like this up already, but if not then this is the first thing I'd try)

(+1)

Ah, that solved it! thank you so much!