How do I load image for different sprites

Get help using Construct 2

Post » Wed Nov 26, 2014 7:47 pm

I have sprite with var called URL in it.
Im creating some number of sprites using loop and set different URL values to every sprite.
Then, I want to load image for every sprite using this URL var.
Image

But it doesnt work! Is there any way of making it possible?

Im kinda tired of this disability of C2. Title says "You can now make advanced games without writing a line of code." but it can't even load image for sprite as users want it to. It is obvious that if there is such feature people will want to use it as a way of loading DIFFERENT images for DIFFERENT instances of same sprite. Image
Last edited by Waltan on Thu Nov 27, 2014 6:09 am, edited 1 time in total.
B
39
S
17
G
6
Posts: 238
Reputation: 7,965

Post » Wed Nov 26, 2014 9:29 pm

Here's a working example.

loadfromurl.capx

EDIT**

Im kinda tired of this disability of C2. Title says "You can now make advanced games without writing a line of code." but it can't even load image for sprite as users want it to. It is obvious that if there is such feature people will want to use it as a way of loading DIFFERENT images for DIFFERENT sprites.


Just noticed you said here Different Images for Different sprites. But in the image you posted you look like you are trying to loop through multiple instances of 1 sprite. My example is for loading the image for multiple instances of 1 sprite.
You do not have the required permissions to view the files attached to this post.
Last edited by Minor on Wed Nov 26, 2014 9:46 pm, edited 1 time in total.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Wed Nov 26, 2014 9:42 pm

Minor wrote:Here's a working example.

loadfromurl.capx


Works here, that's fun :) Anyone out there used this much in their games?
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Thu Nov 27, 2014 12:11 am

Tiledbackground can load different images for each instance, here's an example.
https://dl.dropboxusercontent.com/u/139 ... image.capx
B
11
S
2
G
1
Posts: 202
Reputation: 1,580

Post » Thu Nov 27, 2014 6:11 am

Minor wrote:Here's a working example.

loadfromurl.capx

EDIT**

Im kinda tired of this disability of C2. Title says "You can now make advanced games without writing a line of code." but it can't even load image for sprite as users want it to. It is obvious that if there is such feature people will want to use it as a way of loading DIFFERENT images for DIFFERENT sprites.


Just noticed you said here Different Images for Different sprites. But in the image you posted you look like you are trying to loop through multiple instances of 1 sprite. My example is for loading the image for multiple instances of 1 sprite.


So, the problem is in number of Animation Frames? If I have like 802 possible images, i should make 802 animation frames? If it possible to add new frames during the game?
B
39
S
17
G
6
Posts: 238
Reputation: 7,965

Post » Thu Nov 27, 2014 7:56 am

yes codah I have in one of our game for someone on contract
B
252
S
39
G
15
Posts: 1,964
Reputation: 40,753

Post » Thu Nov 27, 2014 8:54 am

Awesome
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Thu Nov 27, 2014 10:51 am

Vladoss wrote:So, the problem is in number of Animation Frames? If I have like 802 possible images, i should make 802 animation frames? If it possible to add new frames during the game?


You can't add animation frames at runtime if I recall correctly.

You'd only need 802 frames if there are going to be 802 instances of the sprite on screen at the same time. You would have to think about how many sprites can appear and maybe a different way of storing the URL either in an array or dictionary. That way you can use the same sprites all the time but reload a new image from url into that same frame as and when needed.

A lot depends as well on the type of game you are making.

It's not going to be super easy to achieve what you want but with a bit of planning should be achievable.

EDIT***

If you don't mind the use of 3rd party plugins Rojohound's paster plugin might be a better option. But again depends on what type of game you are making.

https://www.scirra.com/forum/plugin-paster_t88750?&hilit=paster

loadfromurl-paster.capx
You do not have the required permissions to view the files attached to this post.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 48 guests