Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / How to UV scroll a texture on a non-square sprite?

Author
Message
Coilwinder
11
Years of Service
User Offline
Joined: 28th Feb 2013
Location: Norway
Posted: 10th May 2015 22:38
Hi there, I'm starting to mess about with AGK2 more and more lately.

I hope the question is asked somewhat sensible, I'm kind of new to this graphics stuff. Basically, I want to make a football (IE a round sprite) with a moving pattern to indicate the football rolling. For simplicity. So I was wondering if that is possible?

I would guess that SetSpriteUVOffset could be used, but the moment I set a different image to my football sprite, it becomes a square

I'm aware I can make an animated sprite, and as it seems right now that is the way to go. I just thought I'd ask anyway.


Apologies in advance for typos and strange grammar.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 11th May 2015 15:14
Pretty good grammar by my reckoning!

If your ball is only rolling sideways (like a side-scrolling game) then you can simply set the angle of the sprite or use a physics based sprite and it will roll all by itself.

If you are doing a top-down football game then an animated sprite would be easiest and again it would be fairly easy to change the direction of the roll by setting the angle of the animated sprite manually.

There isn't really such a thing as a 'round sprite' in AppGameKit, all sprites are effectively rectangular. Using SetSpriteUVoffset is just a manual way of achieving what the sprite animation commands do and are really designed more for doing unusual UV offsets such as making grass that waves in the wind.

Using AppGameKit V2 Tier 1
Coilwinder
11
Years of Service
User Offline
Joined: 28th Feb 2013
Location: Norway
Posted: 11th May 2015 16:10
Thanks for answering!

I guess I explained it a bit bad then By "round sprite", I meant a (normal / square) sprite with some round alpha mask. So I thought it might be possible to do some kind of texture scrolling, masking out the parts you don't want on the sprite (if that's possible).

At least that's what I thought UV offsets could be used for (the scrolling part, not the alpha masking).

Anyway, I went with the animated sprite and setting the angle, which worked pretty well And yes I'm trying to make a top-down football-ish game, mostly for testing and learning AGK2.

Apologies for any typos and strange grammar.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 11th May 2015 16:23 Edited at: 11th May 2015 16:34
its also possible to combine 2d & 3d.
http://tf3dm.com/3d-model/soccer-ball-80310.html

i think uv scroll is possible with a rectangle ball texture and
a circle shape mask to cut you the ball itself. (but me not know a agk solution for it)

maybe a generated ball image with memblock commands.

i think a pre rendered image as baxslash said is best.

AGK 108 (B)19 + AppGameKit V2 Beta .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)

Login to post a reply

Server time is: 2024-06-29 03:04:54
Your offset time is: 2024-06-29 03:04:54