Originally Posted by
Dark Cloud
and that should be it for now
Just a few minor topics then Dark Cloud!
Hit Test All you are doing is using the condition to see if 2 objects are colliding - Put 2 movie clips on the stage red_mc & green_mc
code:
_root.onEnterFrame = function() {
_root.red_mc._x += 10;
_root.green_mc._x -= 10;
if (red_mc.hitTest(_root.green_mc)) {
trace("Hit");
}
};
Gravity The equation for gravity is:
F =G*(mass1*mass2)/distance*distance applying this in Flash will make blood come out our ears! A better & just as effective way is to come up with a value for gravity & then apply that every frame:
code:
ymov=0;
//set gravity
gravity=2;
_root.onEnterFrame=function () {
ymov+=gravity;
ball._y+=ymov;
if (ball._y > 400) {
ball._y=400;
ymov*=-1;
}
}
This adds to gravity as mentioned above an then checks the clips _y position if it is at the same level as the floor it reverses the clips downward motion.
Platforms Just set an absolute _y position for your games through which your charaters can not pass, along the lines of if (mans._y>=100){
mans._y=100.
Having said all that game design in Flash can be complex & complicated business for example to make platform games more efficient you would build your world out of tiles (both Platform & Iso) & check for the position/collision of a character using some pretty clever tricks. There are a few really good books on the subject I recommend Jobe Makar's "FlashMX Game design demystified" although written for MX(2000) the object orientated nature of his code should work well in 2000.