I have a family called cards and it randomly chooses one of the "cards" I then want to store the chosen card in a variable called "Chosen card". I've wanted to do stuff like this in the past but I can't find an expression for a specific object's name.
You can store Cards.UID in this variable.
When you need to pick the chosen card, use "Cards Pick by Unique ID=chosenCard" condition.
Not UID. I'm looking to choose a card (let's say CatCard) and then have the game spawn the correspondent animal (so the cat) I was thinking I could do something like "Set variable "animaltospawn" to card.name -Card (as the cards are called stuff like dogcard and catcard) and then spawn by name animaltospawn.
If the cards are in a family you can use family.ObjectTypeName and store that.. then you can create by name and pass that in
Oh, so you need to store the sprite name? Use Cards.ObjectTypeName expression.
Oops, too late :)
Oh I thought that would store the objects type. Like sprite, tiled background, array ect
Develop games in your browser. Powerful, performant & highly capable.
Okay so that works. Now is there anyway to subtract a word from a string? It says I can't subtract string on string. I want to remove the word card from the variable
Set s to replace(s, "card", "")
I dont understand why the letter s is being used?
I ended up getting it working using this.
replace(Cards.ObjectTypeName,"card","")
I probably wouldn't have been able to do it without you guys.