Monday, October 19, 2009

Making Cars Go Bump in the Night


Finished another pleasant day at school, with one 3 hour canceled, leaving only one that started at 2:30pm.  It was kind of nice being able chill wth the ladylover and watch some Californication this morning instead.

Once at school, we continued to animate a car moving around the screen.  What I accomplished last week was keeping the car on the stage by cutting the speed to 0 when it hit the ed of the stage.  Now we are adding obstacles, which adds a new level of fun, both programming wise, and playwise.

It's pretty easy to moniter a hit between 2 objects, but each object is surronded by a an invisible box.  When Flash records a hit, it is when the two boxes overlap, but the eye, the objects are afair distance apart:


There is a trick out there to watch different coloured pixels overlap, that will take some research.

Another issue some people were having was removing a child from the stage.  We created the obstacle in an array of obstacles, but removing individual elements are turning oout to be a bit of a complicated pain.  Some more reasearch is required.

UPDATE:  Getting this error when I try to remove a child
                    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/removeChild()
    at DocClass/HitObject()

Here is what my code looks like:
for ( var count:int = 0; count < NUM_OBS; count++ ) {
                 if ( car_mc.hitTestObject( obsArray[count] ) )
                 {
                     trace("HIT!!  KABOOM!!" );
                     obsArray[count].scaleX /= 2;
                     obsArray[count].scaleY /= 2;
                     //obsArray[count].play();
                     car_mc.speed = 0;
                     trace(obsArray[count].scaleX + " " + obsArray[count].scaleY);
                     if ( obsArray[count].scaleX < 0.125 )
                         removeChild( obsArray[count] );
                 }
}

Keeping in mind I am trying to manage an array of obstacles for a simple car game.




Powered by ScribeFire.



Friday, October 16, 2009

Databases - Microsoft Access

Year 2 inlcudes an introduction databases.  We get to cover the exciting world of Microsoft Access and Visual Basic for Applications (VBA).  Last school year, we had an introduction to Visual Basic, and I figured that would translate well to VBA when used with Access.  I was wrong.

The basic concepts behind Access are failry simple.  Getting into VBA code is pretty annoying.   This goes back to my preference for C and C++ syntax.  VBA makes absolutely no sense to me.  It's a convoluted language that has too many wierd quirks to remember.  I especially do not like how VBA will automatically shift characters a couple of spaces; there is certain way I like to code, and VBA usually prevents me from doing this.

This is also another where there is no text.  Also frustrating as this makes studying at home a little more difficult; having to jump between two windows is annoying.  The teachers notes don't explain how things work behind the scenes in Access and VBA, so I don't truly understand what it is we are doing.  I like to be able to easily look up things, instead of endless Googling hoping someone has had the exact same issue as me.



Powered by ScribeFire.

Flash - My First Experience

Adobe Flash Pro CS4 [Mac]

 I have discovered that I am not an artist, or designer in any kind of way.  I can not draw.  Take a look:



That is probably the best car I have drawn on a computer, and only the second best one ever.

My Mutimedia & Internet class is based on Flash and ActionScript.  After a an introduction into basic animations such as Classic, Shape, and Motion Tweens, we have moved onto ActionScript 3.0.

I find the Flash platform a crappy development environment.  I do not have much experience with animation, and  I am new to the Flash environment, but there is something unrefined about the user experience and the workflow.  The compiler and debugger seem as though they were added as an after thought.  It would be nice if there was a more unified approach to developing with ActionScript;  compiling should be a step by it self, where error messages are reported by themselves.  As it is, errors are being reported once Preview Movie is Selected.

Even the teacher says Flash CS4 is not the greatest tool available, and is looking for alternate methods for developing with ActionScript.  Since Flash is a very closed piece of software, I do not think he will be too successul.

On th upside, my ugly can turn, acclerate, and has an emergency break.  What I am looking to add is a way get the car bounce slightly off a wall (the wall being the edge of the stage).  I am open to any suggestions.

Powered by ScribeFire.