Pregunta

I downloaded flixel and photonstorm in order to their perfect collision stuff (FlxCollision); in my root folder I have the flixel org folder and inside org/plugin I extracted photostorm as instructed at their site; I'm importing it here:

import org.flixel.*;
import org.flixel.plugin.photonstorm.*;

The problem is that when I call the function that will detect the collision (if statement to be precise) I get this error:

if (FlxCollision.pixelPerfectCheck (ball, goalkeeper)){
      ball.y=portero.x-ball.height- ball.width;
     trace ("Tomela");

}

Scene 1, Layer 'action', Frame 1, Line 72   1067: Implicit coercion of a value of type flash.display:MovieClip to an unrelated type org.flixel:FlxSprite.

I'll really appreciate if you guide me a little bit, I'm using Flash Professional CS5.

¿Fue útil?

Solución

FlxCollision.pixelPerfectCheck takes FlxSprite objects as parameters. You are passing in MovieClips as your arguments (either one or both), hence the error.

Either change your objects to be FlxSprites or use a pixel perfect collision library that works on MovieClips.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top