Attention: iDevGames forum has a new home at http://www.idevgames.com/forums.
Please update your bookmarks and linkage.
This forum has been locked and will be available for archival purposes only.
iDevGames - Mac, iPhone, iPad & iPod Game Developers Forum  


Game Programming Fundamentals Discuss AI, event handling, collision detection, math, physics, user input, etc.

 
 
Thread Tools Display Modes
Old
  (#1)
FreakSoftware
Moderator
 
Posts: 882
Join Date: 2002.05
Location: Anaheim Hills, California
Parallax Scrolling -- I've got it! - 2002.10.06, 07:27 PM

Well, I figured out parallax scrolling on my own. I figured it couldn't be too hard, so I thought about it for a second, and played with it for a while and I figured it out.

Here's the two lines of code (per layer) that it requires:

LayerOffset = DeltaX * ((LayerWidth - ViewWidth)/(ForegroundLayerWidth-(ViewWidth*2))
DrawPicture LayerPicture, LayerOffset, 0

Where ViewWidth is the width of the animation area (i.e. if you wer e full screen, ViewWidth would be the screen width), and DeltaX is the number of pixels that you're scrolling.

One thing I did notice is that in my current example project, the Foreground scrolling rate isn't equal to 1, it's actually equal to 1.3 which is kind of odd. I know that it makes sense mathematically using the code above, but I wonder what I would need to change to get it equal to 1 instead. If you have any ideas on that, could you let me know?



One other question, where did the word Parallax come from? It obviously sounds like a combination of parallel axis, which kind of makes senses, but is that really where it came from?
   
Old
  (#2)
ededed
 
Posts: n/a
2002.10.07, 11:17 AM

Well on the subject of flaunting your own intelligence. To test if you have cliked on an odd or even isometric tile of size 64*31

sin(((x-32)*pi)/64)>cos(((y-64)*pi)/32)

It works on my computer I have rigerously tested it I worked that out myself too!!!
   
Old
  (#3)
KittyMac
Member
 
Posts: 227
Join Date: 2002.09
Location: Atlanta, Georgia
Re: Parallax Scrolling -- I've got it! - 2002.10.07, 12:50 PM

Quote:
Originally posted by FreakSoftware
One other question, where did the word Parallax come from? It obviously sounds like a combination of parallel axis, which kind of makes senses, but is that really where it came from?
From what I know, the word parallax came from astronomers who use the parallax of stars in order to determine their distance from earth. You can do this because of the properties of a triangle and by using basic geometry to solve for the correct side of the triangle.

Cheers,
Rocco
   
Old
  (#4)
FreakSoftware
Moderator
 
Posts: 882
Join Date: 2002.05
Location: Anaheim Hills, California
Re: Re: Parallax Scrolling -- I've got it! - 2002.10.07, 08:40 PM

Quote:
Originally posted by KittyMac
From what I know, the word parallax came from astronomers who use the parallax of stars in order to determine their distance from earth. You can do this because of the properties of a triangle and by using basic geometry to solve for the correct side of the triangle.
Now that makes perfect sense. Thanks
   
Old
  (#5)
Fenris
Moderator
 
Posts: 948
Join Date: 2002.09
Location: Stockholm, Sweden
The meaning of the word Parallax - 2002.10.11, 02:12 PM

I'm not really sure on the full meaning of the word, but here's my two cents; para- is a prefix for "beyond" or "more than" or even "after". -lax is a stem for a lot of words meaning "wider", "wide", "widening", "extending" and suchlike.

Thus, parallax would mean something around the lines of "beyond the wide", which is quite appropriate for something used to measure stars.

All in Latin of course.
   
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com
DevServe Network: iDevApps | uDevGames | iDevGames