-
Notifications
You must be signed in to change notification settings - Fork 4
/
README
79 lines (53 loc) · 2.11 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
====================================================================
PARALLAX CLASS
====================================================================
Version: 0.8
Made by Griffin Adams ( theIdeaMen ) 2011-2012
Twitter: http://www.twitter.com/theIdeaMen
eMail: duff333@gmail.com
MIT License
You can use and change this code free of purgery or death as long
as you promise to have fun or something along those lines.
Thanks to Brent Sorrentino for a great parallax demo, the
the starting point from witch this class was born.
Feedback welcome!
====================================================================
CHANGES
====================================================================
03-02-2015 - Tim Catania - Replaced depreciated setReferencePoint
02-05-2012 - Griffin Adams - Major update/rewrite
- see 'Old' branch for previous history
====================================================================
INFORMATION
====================================================================
* Import the class like this:
parallax = require( "parallax" )
* To create a new scene
yourScene = parallax.newScene(
{
width = [X SCENE SIZE],
height = [Y SCENE SIZE],
left = [SCENE X BEGINNING POS],
top = [SCENE Y BEGINNING POS],
[repeated = [REPEAT FOREVER, "horizontal","vertical","both"]
} )
* To add a new layer to the scene
yourScene:newLayer(
{
image = [IMAGE NAME],
width = [IMAGE WIDTH],
height = [IMAGE HEIGHT],
[top = [IMAGE Y POS],]
[bottom = [IMAGE Y POS],]
left = [IMAGE X POS],
speed = [HOW FAST, 0 - 1 for backgrounds, > 1 for foregrounds],
[repeated = [INF SCROLL, "horizontal","vertical","both"]]
} )
NOTE: Create your layers in order from closest to farthest away
NOTE: All x/y coordinates should be in relation to the screen (not local)
* To add objects to a layer
yourScene:insertObj( object, [layer] )
NOTE: If no layer specified, defaults to the top layer
* To move a scene
yourScene:move( deltaX, deltaY )
====================================================================