Sprites and dynamic spritesheets

For questions about using Classic.

Post » Fri May 29, 2009 8:30 pm

Hey guys!
I began working on a game recently which, unlike my previous works with Construct, uses it's own engine for maps rather than different layouts and hard-designing through Construct.
I am currently working on a MapEd utility for the game's engine and I'm using Image Manipulator to crop tilesets and dynamically apply them to sprites.
Problem is that once I update one sprite (using both Load from file after saving a cropped tile with Image Manipulator OR using IM's "to sprite" function) the rest of them change into that same tile and therefore I end up having a map with the same tile repeating.
Is there a way to fix that using a SINGLE sprite object, or should I give it up and use 128(!) different sprites per spritesheet...?
Thanks in advance!
Roy
B
3
G
3
Posts: 16
Reputation: 957

Post » Fri May 29, 2009 8:34 pm

Since the texture is stored on the sprite, I'd assume you need a single sprite for each tile.
Which is why I keep nagging for the tilemap object :P
Nice, however, cropping and assigning. And MapEd.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Fri May 29, 2009 9:14 pm

Thanks for your help Madster.
I found out that assigning different animations to different objects before inheriting the image itself fixes the problem. So for now I've manually created 128 animations to the sprite and the code's just gonna call the right animation before sending the picture to the sprite object.. Till I find a better solution.
Cheers!
B
3
G
3
Posts: 16
Reputation: 957

Post » Fri May 29, 2009 9:45 pm

Just checked, and the expression sprite.oid is usable, but sprite.uid is not.
So there goes that idea.
There might be a way via picking, to use system create object and switching from one to another.
Edit never mind, disregard all that, its strictly one image per sprite, copies cannot have multiple images.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Sat May 30, 2009 1:45 am

The animation route is a good solution to tile mapping, except it's hell when your designing your levels, because you have to assign the correct pv's to each and every tile so they display the right animation. Plus you don't see results in the layout editor. Anyway, you said your going be using a homemade level editor so thats not a problem i guess.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Sat May 30, 2009 2:48 am

[quote="Davioware":6aq9ugps]The animation route is a good solution to tile mapping, except it's hell when your designing your levels, because you have to assign the correct pv's to each and every tile so they display the right animation.[/quote:6aq9ugps]

Not if you create your own dynamic placement routine that checks the top/bottom/left/right edges of, say, tiled background object dummies, and places the sprites and assigns their frames accordingly.

Or you could have each sprite detect whether it's got a neighbor on whichever side and have it set it's own frame to line up with it's neighboring tiles.

Either way you wouldn't have to do anything except place one kind of tile per terrain type, and the map would sort itself out at runtime.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat May 30, 2009 3:09 am

[quote="deadeye":1ehrh24h]Not if you create your own dynamic placement routine that checks the top/bottom/left/right edges of, say, tiled background object dummies, and places the sprites and assigns their frames accordingly.[/quote:1ehrh24h]

hehe, i did do this for one of my games. I'm just talking about someone who wants to manually place tiles.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Sat May 30, 2009 3:20 am

with Animations you would still be reserving the next power-of-two in VRAM for each tile though. which kinda misses one of the main benefits of tilemaps.
(The other benefit being it's comfy)
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sat May 30, 2009 1:48 pm

Im pretty sure that a tile map would still have to be a power of two or it would be upscaled to the next power of two. That is just how the hardware and DirectX works.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Sat May 30, 2009 10:12 pm

Well the system is made so I could easily create maps, not for reserving memory.
Each tile is 24x24, probably means it'll take a 32x32 memory of VRAM if what you guys say is true.
Since every map reloads the tilesheet I don't think it will overload the system too much, even of your computer is a tad old.
Another question though, guys: is it possible to encrypt archives with a password only the game has an access to, in order to store my files? Since almost nothing is reserved as a resource, I'd like to protect my files; I didn't find any password function within the ZIP object. So, what method could I use?
Thanks!
B
3
G
3
Posts: 16
Reputation: 957

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests