Well, I've made some progress on learning the scene module, but now I've come across a rock.
Here is some code from the tutorial:
1 from scene import *
2 import sys
3 class MyScene (Scene):
4 def setup(self):
5 self.layer = Layer(Rect(self.size.w * 0.5 - 100, self.size.h * 0.5 - 100, 200, 200))
6 self.layer.background = Color(1, 0, 0)
7 self.layer.animate('alpha', 0.0, duration=1.0, autoreverse=True, repeat=sys.maxint)
8 def draw(self):
9 background(0, 0, 0)
10 self.layer.update(self.dt)
11 self.layer.draw()
12 def touch_began(self, touch):
13 new_frame = Rect(touch.location.x - 100, touch.location.y - 100, 200, 200)
14 self.layer.animate('frame', new_frame, duration=2.0, curve=curve_bounce_out)
15run(MyScene())
I'm going to explain each line as it makes sense to me.
1-2)imports modules. Basic
3-4) beginning to create the scene
5) creates a"piece of paper", if you will. We then draw a rectangle on it.
6) making this rectangle red
7) creating an animation. I do not know what all of the things in it means though. The sting at the beginning is unknown to me, as is the number after it. The rest are mainly about how long the animation lasts and does it repeat and so on.
8) drawing what we just set up
9) setting black to the background of the entire page/screen
10) updates (think reloads) the drawing. Not sure what self.dt is. I know that dt is delta time (better known as change of time)
11) redraws the drawing? NOTE if I were to make the rectangle into an image this causes the program to stop (error)
12) if something touches the screen do...
13) New location of the rectangle
14)new animation. I understand what curve is (it is the fancy movement). I don't get the rest though.
15) run the scene.
If I wasn't clear enough let me know!
Thanks for any help you give,
Cubbarooney