Hello,
I'm using Game Maker Studio and it has been many days that I'm trying to resolve that bug.
I can't figure out why it's happening.
I already tried to clean the "cache" but no luck.
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object object91:
Push :: Execution Error - Variable Get -1.mvyMax(100171, -2147483648)
at gml_Object_object91_StepNormalEvent_1 (line 16) - mvy = Approach(mvy, mvyMax, gravNorm);
############################################################################################
I understand that the program is telling me that the variable "mvyMax" doesn't exist in my "object91" but that's strange because I wrote it my "create" event.
///Basic Variables
jumped = false;
landed = false;
platformTarget = 0;
wallTarget = 0;
push = false;
wallslide = false;
// Velocity
mvx = 0;
mvy = 0;
// Used for sub-pixel movement
cx = 0;
cy = 0;
onGround = OnGround();
cLeft = place_meeting(x - 1, y, obj_wall);
cRight = place_meeting(x + 1, y, obj_wall);
// Movement //////////
groundAccel = 0.50; //1.00; //1.00
groundFric = 0.50; //2.00; //2.00
airAccel = 0.30; //0.60; //0.75
airFric = 0.01; //0.01
mvxMax = 1.00; //4.00; //5.5
mvxMaxCap = 1.00;
mvyMax = 5.00; //12.0; //10
mvyMaxCap = 5.00;
mjumpHeight = 3.00; //10.0; //8
mjumpHeightCap=3.00;
gravNorm = 0.25; //1.00; //0.5
mdir = 1; //Direction
preventfalling = true;
left = 0;
right = 0;
image_speed = (5+irandom(3))/100; //=Between 0.05 & 0.08
//Start walking towards Player
alarm[10] = 1
Here's the code that is getting the error.
///Movement
var tempAccel, tempFric;
// Apply the correct form of acceleration and friction
if (onGround) {
tempAccel = groundAccel;
tempFric = groundFric;
}
else {
tempAccel = airAccel;
tempFric = airFric;
}
// Handle gravity
mvy = Approach(mvy, mvyMax, gravNorm);
//Change direction when encountering a wall
if (place_meeting(x+mvx,y,obj_wall)) && (right == 1)
{
left = 1;
right = 0;
}
if (place_meeting(x-mvx,y,obj_wall)) && (left == 1)
{
left = 0;
right = 1;
}
// Left
if (left != 0)
{
// Apply acceleration left
if (mvx > 0)
mvx = Approach(mvx, 0, tempFric);
mvx = Approach(mvx, -mvxMax, tempAccel);
// Right
}
else if (right)
{
// Apply acceleration right
if (mvx < 0)
mvx = Approach(mvx, 0, tempFric);
mvx = Approach(mvx, mvxMax, tempAccel);
}
// Friction
if ((left=0) && (right=0)) {
mvx = Approach(mvx, 0, tempFric);
}
Here's the script "Approach".
/// Approach(start, end, shift);
if (argument0 < argument1)
return min(argument0 + argument2, argument1);
else
return max(argument0 - argument2, argument1);