table handie.swf [ 3.99 MiB | Viewed 58614 times ]
bed_intruder Wrote:- what is the code for turning objects into barriers
bed_intruder Wrote:- how do you get the text box to close completely after you press the button
bed_intruder Wrote:- how do you get Krystal to "interact" with the other characters
bed_intruder Wrote:- how do you get each individual layer in an object to go a different speed and loop separately
bed_intruder wrote:
- how do you get Krystal to "interact" with the other characters
That's a MUCH bigger question than you probably realize. For starters, the hitTest command is a good way to tell the game if the two movieclips are touching, but it's rather limited (it draws a bounding box around both sprites, so if whitespace overlaps whitespace it still considers them to be touching). Once you determine whether or not the sprites hit, the real question becomes what do you do? Personally, I move one of the two sprites off screen (not unloaded though), while the other sprite skips to an animation with the correct 2 (or more) characters. There are many other ways though, so play around & figure out what method you like best.
//Per-pixel Collision Detection.
/// <summary>
/// Performs Per-Pixel Collision detection on two given game objects.
/// </summary>
/// <param name="gameObject1">The first Game object.</param>
/// <param name="gameObject2">The second Game object.</param>
/// <param name="minimumAlpha">The minimum Alpha value to be checked for collision.</param>
/// <returns>True if the collision occurs.</returns>
/// <warning>Does not work with Rotation or Scaling.</warning>
public static bool PerPixelCollision(GameObject gameObject1, GameObject gameObject2, int minimumAlpha)
{
Color[] sprite1;
Color[] sprite2;
sprite1 = new Color[gameObject1.Width * gameObject1.Height];
gameObject1.Graphic.Texture.GetData(sprite1,
gameObject1.Graphic.Frame * (gameObject1.Width * gameObject1.Height),
gameObject1.Width * gameObject1.Height);
sprite2 = new Color[gameObject2.Width * gameObject2.Height];
gameObject2.Graphic.Texture.GetData(sprite2,
gameObject1.Graphic.Frame * (gameObject2.Width * gameObject2.Height),
gameObject2.Width * gameObject2.Height);
//Set up the area of collision
int top = Math.Max(gameObject1.BoundingBox.Top, gameObject2.BoundingBox.Top);
int bottom = Math.Min(gameObject1.BoundingBox.Bottom, gameObject2.BoundingBox.Bottom);
int left = Math.Max(gameObject1.BoundingBox.Left, gameObject2.BoundingBox.Left);
int right = Math.Min(gameObject1.BoundingBox.Right, gameObject2.BoundingBox.Right);
//Loop through each pixel.
for (int x = left; x < right; ++x)
{
for (int y = top; y < bottom; ++y)
{
Color color1 = sprite1[(x - gameObject1.BoundingBox.Left) + ((y - gameObject1.BoundingBox.Top) *
gameObject1.BoundingBox.Width)];
Color color2 = sprite2[(x - gameObject2.BoundingBox.Left) + ((y - gameObject2.BoundingBox.Top) *
gameObject2.BoundingBox.Width)];
if (color1.A != minimumAlpha && color2.A != minimumAlpha)
{
return true;
}
}
}
return false;
}
bed_intruder Wrote:Wow flash coding sounds really complicated,
dudelikeporn Wrote:Yeah, don't set it to such a high framerate. My computer handles it fine, but others are not so lucky.
Besides, 120 frames is redundant, on account of the human eye being able to perceive around 60 frames max.
Acidrayne360 Wrote:dudelikeporn Wrote:Yeah, don't set it to such a high framerate. My computer handles it fine, but others are not so lucky.
Besides, 120 frames is redundant, on account of the human eye being able to perceive around 60 frames max.
So does that mean I'm hyperperceptive considering I can pick out the individual frames just as easy as if it was going the normal rate?
Yea I just realized the max fps my computer runs is 60 frames so even if I make the fps higher the animation still takes 7 seconds. Definitely not making a 420 frame animation again. For some reason I can't upload the .fla the screen just freezes up trying to put it up on here, anyone know what's up with that?dudelikeporn Wrote:Yeah, don't set it to such a high framerate. My computer handles it fine, but others are not so lucky.
Besides, 120 frames is redundant, on account of the human eye being able to perceive around 60 frames max.
Users browsing this forum: No registered users