I am making a platform game in AS2 for school and everything works, but the rotation of the character to the ground. The problem is, is that the character hits the symbol box and not the image inside it.So does anyone know how to make it hit the image and not the symbol box around it
why do you say _xscale = -scale? You also defined the variable scale to equal _xscale...so you are never telling it to = 1 or -1. You are just telling it to equal itself, which is probably why it won't work. What you should do is just replace the line _xscale = -scale; in the left key down statement with _xscale = -1; and the _xscale = +scale; in the right key down statement with _xscale = 1;
Ok, I was thinking about what I had said, since I use AS3, not AS2. I always forget if _xscale is on a scale of 1 to -1 or 100 to -100. Try _xscale = 100;, etc, in place of _xscale = 1;
ok, here is the new code. It now has two dots that are seeing if it hits a slope
Code: onClipEvent (load) { speed = 4; jump = 0; jumpheight = 9; gravity = 0.5; scale = _xscale; wid = _width/2; heig = _height/2; //when the character moves his feet will play the animation, but when the movement stops, the feet reset to a rest position }
I see what your problem is and I understand how it can be frustrating. There are a few things you can do to fix it.
1. Probably the easiest way to fix this is to create a smaller, "hidden" box around the character to create a more accurate effect.
2. Find a "Pixel Perfect Collision Detector." There are people out there that wrote their own class to create a feature that isn't native to flash. It will probably seem complex, but you will get used to it after awhile.
It depends on what you're colliding. If you're trying to test a ball against a polygon, you can loop through a number of points around the circle and see if any of them are colliding using the shapeFlag = true param. Or you can use a bit more complicated approach and test every pixel, or you can do something in between, though it's much more complex, but it is from the developers of n and is a great tutorial.
That would probably be a great improvement for Flash... having a hittest that you can use as easily as objectA.hitTest(objectB) but which does allow the freedom of choosing wether to use bounding boxes, or the actual shapes.
Right now, like dank said, there are no easier ways.