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 / horizontal scrolling two images side by side in tier 2

Author
Message
fhalo
12
Years of Service
User Offline
Joined: 10th Jun 2012
Location:
Posted: 3rd May 2015 18:23
Hi

I've got two simple bacground images connected next to each other. Would like to scroll horizontal.

How do I setup the Image wrap, so that it repeats after displaying the second image. At the moment the setdefaultWrap, repeat after displaying the first image.

Any ideas?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 3rd May 2015 19:54 Edited at: 3rd May 2015 19:58
Quote: "two simple bacground images connected next"

means one image?

u make the sprite as wide as you want
then use a scale to repeat the image inside the sprite
SetSpriteUVScale ( iSpriteIndex, scaleU, scaleV )

SetDefaultWrapU 1 for repeat (U=X)
SetDefaultWrapV 0 clamp (V=Y)
better this
SetImageWrapU ( iImageIndex, mode )
SetImageWrapV ( iImageIndex, mode )

you can scroll the image also with u 0-1,else move the sprite
SetSpriteUVOffset ( iSpriteIndex, u, v )

if the background image is opaque use
SetSpriteTransparency( iSpriteIndex, mode ) 0=off, its faster.

AGK 108 (B)19 + AppGameKit V2 Beta .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 3rd May 2015 20:10
If you look at the help for SetSpriteUVOffset(), you'll see that it is better to having a number of scrolling sprites, rather than scrolling textures. There are too many caveats to make texture scrolling work successfully in most scenarios. As one sprite scrolls off the end of the visible screen, you can wrap it around to the other side again.

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
fhalo
12
Years of Service
User Offline
Joined: 10th Jun 2012
Location:
Posted: 4th May 2015 17:07
Thanks for this BatVink.

Will look into SetSpriteUVOffset() more detail.

Login to post a reply

Server time is: 2024-11-25 21:58:06
Your offset time is: 2024-11-25 21:58:06