tirsdag 9. november 2010

Case 5


 Activating animations and hitting the ground

In this case it’s still all about the scripting. This time I’m going to trigger specific animations of my character at the right place. I also have to make points for the character to pick up, I have to make it stay on the ground and I had to place some of my objects with the aid of an entirely new class.

After I was done with my previous blog, but had not been given the next case I tried to work with flipping my character. After I had asked my classmates and looked over what they’d done I realized that the only thing I had done wrong previously was that I hadn’t put a block around the scaleX part. Although annoyed with how scripts work, I was happy with making the character flip before we got the next case, only to be disappointed that I didn’t need it. Because we were to use the sprite instead.

 I began the case with making the Sprite I needed to make my character animations. I had already tried and failed in making myself a sprite and we got no indication on how we should activate it. I had managed to make it, but I couldn’t activate it without playing all the animations at the same time. I figured that I couldn’t do it on my own so I poked someone in my group who had managed to do it perfectly (Yngvar: itsketchup.blogspot.com). He managed to explain it to me so that I actually understood what was happening. And then the sprite was finished.

To do what the assignment asked, I put the closest trees on a new class of their own, making me able to add more of them than I would by merely adding them as objects alone. I also changed the way the scene looked to make it more alike the scene I had made in the animation part. To make that happen I had to make the background move instead of the character. It wasn’t particularly hard, but it took a bit of time and space (in my actionscript).

Secondly I made the points that the character was to pick up. I made them first with a class of their own, but I figured that when the character picked up one all the others would disappear as well. I ended up with making only two which were objects which I had placed on my scene. Making the character hit them with hitTest wasn’t hard, but what would happen to them when it hit? I tried just moving the points out of the scene, but I sort of thought of it as cheating. Mostly because it was way too easy. 

I ended up with only reducing alpha to zero, making them invisible instead, although I have the feeling there is some other smarter way of picking the points. I also tried removeChild and it sort of worked, but there was a whole lot of error/warning type of messages appearing on my output window so I figured I’d leave it with alpha until further notice.

I saved the hardest part for last as I always do. I’d never thought my joke about Mount Everest would be taken so literally. I spent most of the time we had on this case to try to figure out how to make my character “hit” the ground. We were told that we were to use a while function and a hitTest. Other than that we were left to think for ourselves. People who understand scripting probably found it easy, but I certainly had no idea on how to do this. I’d almost given up when I got help from a classmate, Kristiane (dornick.wordpress.com). Her group had gone through it and she helped me put the right things at the right places. It was a lovely mess of functions which I really don’t know how our teachers had expected us to understand by ourselves.

I just hope that it doesn’t get any harder that this, because then I’m not sure I’ll be able to do it. At least when we don’t get it explained properly.

Ingen kommentarer:

Legg inn en kommentar