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 / Parallax not working with example code

Author
Message
serandre
11
Years of Service
User Offline
Joined: 14th Sep 2012
Location:
Posted: 14th Sep 2012 19:26
Hi,

I was trying to run the 2nd part sample code from the AppGameKit link bellow:

http://www.appgamekit.com/bitesize-1.php

I donĀ“t get a parallax effect to work, the sprites all move the same speed and not as in the description.

Is there any bug in the code?

Thanks
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 15th Sep 2012 02:53 Edited at: 15th Sep 2012 02:54
There is a bug in the code but there's a really easy fix. Simply add this:

x# = getSpriteXByOffset(spr)
y# = getSpriteYByOffset(spr)
setSpritePositionByOffset(spr,x#, y# )

in the main for loop after this:

Xoff# = -(d#-100.0)*0.01*vx#
Yoff# = -(d#-100.0)*0.01*vy#
setSpriteOffset(spr,Xoff#,Yoff#)

Basically what's happening is that the spriteOffsets are being adjusted but the sprites aren't being repositioned, so the offsets don't have any effect.

Login to post a reply

Server time is: 2024-04-23 09:57:18
Your offset time is: 2024-04-23 09:57:18