Well how does the detection work, sorry still dont know too much about flash 8, does flash re-update the bitmap each time and then it checks for collisions on that, because I thought for some reason that it used some sort of color check, but now I get it so no worries
EDIT: Ya it was just me being stupid I checked out the .fla all makes perfect sense now nice
I noticed the script creates endless loop when you click near the edge of stage so the hole goes out. You should add check for edges:
if (myBmp.getPixel (mc._x + i * dir, mc._y + 1) == 0) {
fall = true;
}
var newx:Number=mc._x + i * dir;
if (myBmp.getPixel (newx, mc._y) != 0 or newx<0 or newx>stageW) {
break;
}
Hmm, I have already done that in flash 6 before, what's the advantage or new about it?
Me too (check the Radar Rik game in my sig for starters - play a level with the laserbeam active), but it's complex and akward in MX. In that game, I have three separate versions of the map - one for the radar level, one for the light beam level and one for the minimap. Each time a hole is blown in the landscape I have to add more clips to the three layers and do hittests against them to allow the player to fly into those areas rather than clipping the original landscape that still exists underneath. One big disadvantage of this is that when the amount of broken land starts to build up, it means loads and loads of new clips overlaying the old ones, which hurts the framerate plenty.
This new method incurs a minor performance hit only when the new bitmap data is drawn to block out some land. After that it's essentially a free effect. It's also a helluva lot easier to understand, and for those two reasons I expect there will be a wave of games using this sort of thing soon.
Forget "how do I make an RPG" noob questions. It'll be "how do I make Worms" instead
A lemming clone, was actually thinking about making one myself but couldnt figure the making of holes thing out, so yep lemmings clone on the way,'wets go!'.
If our body is a clock ticking away and if while we experience all that this world has to offer time has still continued to pass, are we living or just experiencing a slow death?
I noticed the script creates endless loop when you click near the edge of stage so the hole goes out. You should add check for edges:
if (myBmp.getPixel (mc._x + i * dir, mc._y + 1) == 0) {
fall = true;
}
var newx:Number=mc._x + i * dir;
if (myBmp.getPixel (newx, mc._y) != 0 or newx<0 or newx>stageW) {
break;
}
I can't figure out what to do with this code. Could you fix the fla? This is something that would be really good to have and not just for this.
I can't figure out what to do with this code. Could you fix the fla? This is something that would be really good to have and not just for this.
It is suppose to be in checkDir function. I will paste the whole fixed function here:
Code:
function checkDir (mc:MovieClip, dir:Number) {
var fall:Boolean = false;
for (var i:Number = 1; true; i++) {
if (myBmp.getPixel (mc._x + i * dir, mc._y + 1) == 0) {
fall = true;
}
var newx:Number=mc._x + i * dir;
if (myBmp.getPixel (newx, mc._y) != 0 or newx<0 or newx>stageW) {
break;
}
}
if (i > 1 and fall) {
return true;
} else {
return false;
}
}