Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.23 / 5.00 3,881 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.93 / 5.00 4,634 ViewsSo here is the problem, i am writing some behavior simulator
http://www.newgrounds.com/dump/item/ce2ce8ea15e625adf788e4c7 671a71a6
I have mc pitch with top left reg point, and some players. Players movement are fine until x < 0 then strange thing happen.
if(move_player)
{
_speed += _acc;
if (_speed > _maxspeed)
{
_speed = _maxspeed;
}
_angle = Math.atan2(_dy, _dx) * 180 / Math.PI;
if (Math.abs(_angle - rotation) > 180)
{
if (_angle > 0 && rotation < 0)
{
rotation -= (360 - _angle + rotation)// / _turning;
}
else if (rotation > 0 && _angle < 0)
{
rotation += (360 + _angle - rotation)// / _turning;
}
}
else if (_angle < rotation)
{
rotation -= Math.abs(rotation - _angle)// / _turning;
}
else
{
rotation += Math.abs(_angle - rotation)// / _turning;
}
if (_speed < 0)
{
_speed = 0;
}
_xinc = Math.cos(rotation * Math.PI / 180) * _speed;
if (rotation < 0)
{
_yinc = -_speed + Math.abs(_xinc); //Going upwards.
}
else
{
_yinc = _speed - Math.abs(_xinc); //Going downwards.
}
x += _xinc;
y += _yinc;
} RangeError: Error #1125: The index 4 is out of range 4.
Anyone? The problem is that xinc doesn't change but amount of actual movement by x axis does, this is so mystic and annoying as hell
RangeError: Error #1125: The index 4 is out of range 4.
You said "strange things happen". That could mean a billion things. You also said when "x < 0" I don't see a variable called "x". Are you referring to dx? Or something else?
You're being awfully cryptic. It's hard to help you when we don't know what it is you're trying to achieve, and what the code is doing now.
Did you try using "trace()" to output values for debugging?
I changed some code, had rough night, but i manage to sort things out. I didn't mess with movement code but apparently this glitch does not exist anymore
RangeError: Error #1125: The index 4 is out of range 4.