0 votes
by (230 points)
retagged by

I'm using SugarCube 2, making an RPG and trying to put all the stats of an enemy inside an object, so I can just call the property and display the name, stat or image. The only problem I'm having is that I cant program it in a way that the image displays correctly.This is how I'm writing it:

//This is the part that goes inside StoryInit, images is the folder where "Monster" which is the image I want to display its located 

<<set $Enemy ={ name:"Monster",
health: 50,
mana: 50
image: "images/Monster.jpg"
  }>>

and here is when I want to call it:

// Here is how I code the passage where I want to display the image of the enemy


$Enemy.name

<img src= %Enemy.image />

The name displays fine, but the image doesn't display.If anyone has any idea on how to do this correctly please tell me.

1 Answer

+1 vote
by (68.6k points)
selected by
 
Best answer

Try using the [img[]] markup.  For example:

[img[$Enemy.image]]

 

by (230 points)
Thanks, now it works perfectly.
...