[SOLVED] Confused. How do I add an image?

dipstick5000

  • Posts: 47
I've spent about 5 hours on this and I feel like an idiot. I cannot for the life of me figure out how to draw an image in a scene. I realize I'm supposed to make an image, and then the image instance, but I can't exactly figure out how to do that. I'm trying to load an image from a file. I've put the image in a folder I made called "extras" in the particular Stencyl game folder on my computer (per instructions). When I click the drop down triangle under draw "image from file", my only choice that makes sense seems to be from game attributes, but you can't make an image or image instance game attribute. I've tried making image and instance attributes everywhere, like in behaviors and events, but they don't ever show up as a choice. And yes, I checked the boxes for those attributes to activate them (I assume). I'm very frustrated, as it seems like it should be a simple thing to add an image. Could someone please provide a clear, simple step by step? It would be very much appreciated, either that or I'm going to try making a whole new scene using screen shot, with a one frame actor, and completely forget about using images.

« Last Edit: December 26, 2019, 10:34:10 pm by dipstick5000 »
Tonight I'll make a game like Skyrim or Call of Duty. It'll be called Delusional.

Justin

  • *
  • Posts: 4695
In the "image from file" block, you're supposed to type in the name of the image in the extras folder.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

dipstick5000

  • Posts: 47
Justin, thank you very much. Seems simple enough, I don't know why I didn't think of it. However, I still can't get it to work. I assume it must be in a “when drawing” event, but I've tried it other ways. I've tried typing the file name with the extension and without. Is it needed? I've triple checked spelling. I've tried simply attaching it to the screen (preferred), and I've tried drawing it onto a blank image, which is the only way I can figure out how to draw it. Do I use the drawing, or the images blocks? I noticed that fill a circle works perfectly, while draw a circle does nothing. Also I noticed that the error is a behavior error for an event, not a behavior, but I tried putting it in a behavior as well. Is it possible to draw an image on mouse release from an actor (button)? Prefer that, but probably asking too much. Any ideas? Very frustrating and humbling. If I could just get an image to show up anywhere on anything, I would consider that a huge accomplishment for today or this week. Thanks again.
Tonight I'll make a game like Skyrim or Call of Duty. It'll be called Delusional.

Justin

  • *
  • Posts: 4695
In a "when created" event, try something like this.
Code: [Select]
set imageAttribute to [image from file [CorrectNixon.png]]
set imageInstanceAttribute to [instance of [imageAttribute]]
attach imageInstanceAttribute to screen at x, y

Images are different from drawing. Drawing happens every frame, but images are created whenever you want, and then attached to the screen. They're more similar to Actors.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

dipstick5000

  • Posts: 47
Justin, Thank you sooooo much. Worked perfectly.
Tonight I'll make a game like Skyrim or Call of Duty. It'll be called Delusional.

dipstick5000

  • Posts: 47
On the outside chance it could help someone, it was real easy to make my image show up on mouse release instead of when created. I just put that 3rd line into the "On Actor" event, and left the 1st 2 lines in the "Created" event. I was afraid I couldn't do that because I thought an image would be a drawing event. Thanks again Justin for setting me straight. Now I can sleep tonight.
Tonight I'll make a game like Skyrim or Call of Duty. It'll be called Delusional.