Dynamically Load Photo Into Sprite

Get help using Construct 2

Post » Sun Apr 19, 2015 2:50 pm

Is there a way to load a photo into a sprite from an array or data file.

I have a sprite on screen that I want to re-use on different levels. Depending upon what level you are on it should show a different image.
Hoping that I can simply store the images in an array or data file and change them dynamically depending upon what level the user is on.

Thanks.
B
9
S
3
Posts: 146
Reputation: 1,150

Post » Sun Apr 19, 2015 3:00 pm

Wouldn't using different animation-frames or animations do the same?

There is the load image from url - action, but it seems like overkill in this situation.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Apr 19, 2015 8:36 pm

Basically these are photographs (some 100 or so)
I don't want to load them from a url as this will be running on mobile.

Not sure what the best way of doing this is.
B
9
S
3
Posts: 146
Reputation: 1,150

Post » Sun Apr 19, 2015 8:38 pm

well you could add them as project-files and load them from url..

But why not just set them as animationframes?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Apr 24, 2015 8:29 pm

Thanks for your reply it's much appreciated.

I have added them as project files (created a "Photos" folder under "Files" in the Projects view)
So when I create a sprite how do I reference the images within the Photos/Files folder?
B
9
S
3
Posts: 146
Reputation: 1,150

Post » Fri Apr 24, 2015 8:44 pm

..maybe like this?

capx:
http://s000.tinyupload.com/index.php?fi ... 3030111623

EDIT:
OR something like..

capx:
http://s000.tinyupload.com/index.php?fi ... 1768941849


EDIT:
animation;
http://s000.tinyupload.com/index.php?fi ... 1747839811

I actually never used action"Load image from url" to load multiple animation for one sprite
mostly for backgraund images and Tiledbackgraund...
so..I'm guessing it has to have a simpler way.......
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Fri Apr 24, 2015 11:24 pm

Wow thanks for the examples.
That's certainly giving me some ideas to chew over.

I especially like the second example.

All the best.
B
9
S
3
Posts: 146
Reputation: 1,150

Post » Sun May 31, 2015 4:54 pm

I am interested to do something similar.
@korbaach your links are dead, any way you can repost them ?

Thanks
B
4
Posts: 1
Reputation: 202

Post » Sun May 31, 2015 7:41 pm

...I do not remember what it was... :?

probably...some very basic examples...like:

capx> http://s000.tinyupload.com/index.php?fi ... 8313598748
and http://s000.tinyupload.com/index.php?fi ... 8764748114
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests