Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
0
Members

Dynamic Image

A topic by GrandSchtroumpf created May 25, 2016 Views: 689 Replies: 2
Viewing posts 1 to 3
(1 edit)

Hi,

In my game I store the data about my NPC into a Database with a JSON file. I want to have a NPC with a specific image depending on data. For example if it is level 5 I want to put the sprite of level 5.

In a normal TypeScript app I would have put a string with the URL of the sprite (spirte = 'spirteUrl'+npc.level). But on Superpowers I don't know how to do that because the link to the sprite is on the actor, not the script.

Thanks for your help

Moderator

You can do something like this:

this.actor.spriteRenderer.setSprite(pathToYourSprite)

And if you want remove this sprite you can do also :

this.actor.spriteRenderer.setSprite(undefined)