torsdag 11. november 2010

Case #5


For this case we had to add a couple of things to our actionscript.  We had to create a socalled sprite for our character that triggers more than one animation. In addition to this we had to make a hitTest that allows the character to pick up certain objects placed on the scene. We also had to use a similar hitTest making the character stick to the ground while walking.

Seeing as I had already created a sprite function for the character using the idle animation and the walk animation in the previous case, I felt no need adding another one.  I moved on to the hitTest by creating an object, and adding a code to the actionscript allowing the object to dissapear once the character had touched it. At first this didn`t work and as usual Flash refused to tell me why. I later found out that the problem was the (onFrameloop) function for the cloud animation i made in case 4. Apparently adding another code with the same function for my hitTest messed the whole thing up. I fixed this by removing the onFrameLoop Event for my hitTest and placed the code for the hitTest under my first onFrameLoop code. The character was now able to easily pick up the object. I moved on to the sticking-to-the-ground part of the case by first creating a new ground with an uneven surface. After writing the code for this I thought I was done, but ofcourse the character decided to simply fall to the ground an dissapear forever. The wierd thing was that when i applied the function for the background surface it actually worked, and the character would stick to the ground.  My group leader would later point out to me that the reason for this was that the characters position were too low for the ground, and I was like "OMG", and then i fixed it.  


Ingen kommentarer:

Legg inn en kommentar