How Do I Properly Use the New placeSprite function?

Description: Archive discussion
============================
Original description:
Official subforum for LunaLua - an extension framework for SMBX Engine Version 1.3 (which a core of SMBX 2.0). Share your creations that require the use of LunaLUA. You may also share info/tutorials on how to use LunaLUA.

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #1by Sambo » 17 Sep 2015, 3:36

I don't get how the new placeSprite function works. I know you told me how before, but I need an example.
What should be here instead of what I have?:

Code: Select all

function onLoad()
   Graphics.activateOverworldHud(WHUD_NONE)
   Graphics.loadImage("../HUD/world_frame.png")
   Graphics.placeSprite(1, "world_frame", 0, 0)
end
Image
Current Project:
Image

Kevsoft M
Angry developer
Angry developer
Avatar
Kevsoft M
Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #2by Kevsoft » 17 Sep 2015, 7:31

Code: Select all

function onLoad()
   Graphics.activateOverworldHud(WHUD_NONE)
   world_frame = Graphics.loadImage("../HUD/world_frame.png")
   Graphics.placeSprite(1, world_frame, 0, 0)
end
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #3by Sambo » 19 Sep 2015, 2:00

Oh. :facepalm:

I just added an article to the wiki to help other people out with this.

EDIT: The new function doesn't work in the world map, does it? I'm still getting an error.
This is what the error says:
yet aonther error.PNG
yet aonther error.PNG (7.55 KiB) Viewed 694 times
Image
Current Project:
Image

Kevsoft M
Angry developer
Angry developer
Avatar
Kevsoft M
Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #4by Kevsoft » 19 Sep 2015, 12:00

Sambo wrote:EDIT: The new function doesn't work in the world map, does it? I'm still getting an error.
This is what the error says:
...
Did you use the Graphics.* namespace?

Also please be sure that the graphic has been loaded. If you have your image somewhere else than the custom folder then use Misc.resolveFile:

Code: Select all

function onLoad()
   Graphics.activateOverworldHud(WHUD_NONE)
   myPicture = Graphics.loadImage(Misc.resolveFile("HUD/myPicture.png")
   Graphics.placeSprite(1, myPicture, 0, 0)
end


Because if no graphic file is found, then nil maybe is returned.
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬


Return to “LunaLua - Extension Framework”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest