Loading a .png into my game?

For questions about using Classic.

Post » Thu Nov 05, 2009 2:12 am

Is there anyway to load a picture into my game from a file. Like I have a button you press, and it gets a picture file from apppath+"/pictures/Global('filetoload')"
B
7
S
2
G
3
Posts: 139
Reputation: 2,331

Post » Thu Nov 05, 2009 2:24 am

You can do that using "Load animation frame from file" action. The action loads a new picture into the current frame of the animation.

By the way, if you're going to use an equation like that, I think this is more what you want:

[code:2uxw6koy]apppath & "pictures/" & Global('filetoload')[/code:2uxw6koy]
Moderator
B
98
S
36
G
19
Posts: 1,584
Reputation: 17,717

Post » Thu Nov 05, 2009 5:55 am

Thanks
B
7
S
2
G
3
Posts: 139
Reputation: 2,331

Post » Thu Nov 05, 2009 9:02 am

For consistency it's probably a good idea to always use backslashes for local paths. AppPath returns a path with backslashes, so if you append forward slashes you end up with a path like this:
C:\Games\MyGame\pictures/file.png
Luckily Windows can work out what this means but I'd stick with backslashes all the way through to be on the safe side...
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,528


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests