Meaning of cannot convert from 'const int' to 'identifier'?
Posted: Thu Jul 21, 2016 1:05 pm
I've been trying to rework the current SeaCat (Octopus Game) engine by steelwil to something closer to a normal platformer, something I could build all future platformers with.
the player>draw actor>script editor event had the error "cannot convert from 'const int' to 'identifier':
The global code is was accepted fine by here it is anways:
the player>draw actor>script editor event had the error "cannot convert from 'const int' to 'identifier':
- Code: Select all
char *key;
//---------------------------------------
key = GetKeyState(); // Get entire keyboard state
if (IsLeft (key))
{
ChangeAnimation ("Event Actor", "StandLeft", NO_CHANGE);
x -= 3;
action = true;
}
if(IsRight (key))
{
ChangeAnimation ("Event Actor", "StandRight", NO_CHANGE);
x +- 3;
action = true;
}
if(IsJump (key))
{
if(jump == 1)
{
yvelocity = - 8;
jump = 0;
}
if(IsLeft (key))
{
ChangeAnimation ("Event Actor", "JumpLeft", NO_CHANGE);
}
else if (IsRight (key))
{
ChangeAnimation ("Event Actor", "JumpRight", NO_CHANGE);
}
}
The global code is was accepted fine by here it is anways:
- Code: Select all
// Actions
#define STAND 0
#define STEP1 1
#define STEP2 2
#define JUMP 3
#define FALL 4
#define SHOOT 5
//Defining keyboard keys
int IsLeft (const char *key)
{
return (key[KEY_LEFT] == 1 || key[KEY_a] == 1);
}
int IsRight (const char *key)
{
return (key[KEY_RIGHT] == 1 || key[KEY_d] == 1);
}
int IsJump (const char *key)
{
return (key[KEY_x] == 1 || key[KEY_k] == 1);
}