Rotating sprites from a spritesheet

For questions about using Classic.

Post » Mon Aug 27, 2012 12:53 pm

Hey there,

I have been experimenting with spritesheets lately, but from where I stand today, I would say that "messing around" would be a more appropriate term.

THIS is what I did, and also UV-offsetting works now.
However, I fail to establish a working technique to stick the spritesheet to another object, let`s say a sprite, that I can freely rotate (probably due to it`s quad nature).

I tried to give a sprite the TiledBackground`s texture with TextureSetter, but of course this implies the whole sheet and not only the cutout Ive set on the TiledBG. Applying a pixel shader to offset, rotate and zoom the cutout results in an utter mess.

My next shot would be to write and apply a vertex-shader that does the job, UNLESS there`s somebody out there that knows how to overcome the problem.

And yeah, I thought of firing up the sheet to ImageManipulator, do a cropping loop and write the cutout to a sprite, but the loop is ... not that quick.

So, anyone?

Cheers,
the Colonel
Image
B
13
S
4
G
1
Posts: 113
Reputation: 1,712

Post » Mon Aug 27, 2012 8:08 pm

Use a Sprite instead of tiledBackground and use the displacement actions.

http://dl.dropbox.com/u/5426011/examples14/uv_spritesheet.cap
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Post » Mon Aug 27, 2012 8:18 pm

OMGIAMSOSTUPIDFORGIVEMEMASTER!!!oneoneone

I was so furiosly spritesheeting that I forgot about the d-maps.

Thanks alot R0J0!
Image
B
13
S
4
G
1
Posts: 113
Reputation: 1,712

Post » Wed Oct 03, 2012 5:53 pm

Oh oh... when you try to address several sprites, the relative displacement doesn`t work, as if it was ignored for each instance beyond the first. You can verify this if you just copy the sprite several times in your example.

What now?
Image
B
13
S
4
G
1
Posts: 113
Reputation: 1,712

Post » Wed Oct 03, 2012 7:21 pm

It's working here, I added more instances and they still worked as intended. If you create them at runtime you need to set the distort map size before displacement will work.
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Post » Wed Oct 03, 2012 7:49 pm

Jeez... sometimes I really wonder how I came this far. After applying the distort map, it of course works. Thanks again!
Image
B
13
S
4
G
1
Posts: 113
Reputation: 1,712

Post » Tue Oct 23, 2012 9:27 am

Update: Everything is in order now, one thing that I came accross was that the position of the pivot point of the cut-out sprite is related to the original sheet-size, however, the position of the sprite in Construct, is not.
That means to center the pivot point on a 128x128 sprite of your 2048x2048 spritesheet, simply putting the point to 64x64 wont do it, you find the center point by applying (sheet width/sprite width)+(sprite width / 2). Same goes for height.

Cheers,
The Colonel
Image
B
13
S
4
G
1
Posts: 113
Reputation: 1,712


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests