How do i put an image source path inside an object?

0 votes
asked Feb 10 by xakefan69 (180 points)
retagged Feb 10 by xakefan69

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
answered Feb 10 by TheMadExile (43,810 points)
selected Feb 10 by xakefan69
 
Best answer

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

[img[$Enemy.image]]

 

commented Feb 10 by xakefan69 (180 points)
Thanks, now it works perfectly.
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...