Numerous game-breaking bugs, anyone able to help?
Posted: Mon Aug 06, 2012 3:17 pm
I'm having a ludicrous number of game-breaking bugs, and all my attempts to fix them have been for naught. I can't even seem to track down the source of most of these problems, and don't know enough about how game-editor parses to isolate one cause over another. Is there any experienced user who would be willing to help?
I'm using the examples for "advanced platforming" from the wiki, but have made some tweaks where certain aspects wouldn't work and where I wanted specific things. For example, I wanted to add ladders that you could climb through platforms only when going down and not climb through when at the bottom touching a platform. I have tossable objects (now a ball and a rock), floaty boots, and a few other items. I have a "zelda-style" scrolling background and levels with names.
Unfortunately, here are some of the errors:
- Running animation freezes and does not play
This only started recently. Climbing and jumping work fine, but running just freezes. I am using the example from the wiki, but nothing I do will make him animate.
- Character "stutters" when standing by a ladder and attempting to climb - this is a byproduct of how I've handled ladders, but I can't figure out a way to fix it. I've tried a lot of things, none of which work.
- When scrolling in mid-air (jumping from one screen to the next), the character flies at a violent rate. The same occurs when respawning from one level to another while jumping. You just fly off screen and die a second time. I have told the game "if hdir == 2" (jumping), that you stop, but it doesn't do anything different.
-When dying in a new room immediately after a scroll, you often get stuck with the view looking toward an empty room, not the room you respawned in. I even forced it to appear where you respawn. The view flickers and then returns to the wrong room.
- For no reason I can find, the character can no longer pick up rocks unless he's picked up a ball first. The codes are independent of each other (except for specifying they can't happen at the same time), and I haven't changed the code for those two objects--and yet, I can't pick up rocks any more.
I know none of this is solvable without the code, but there are many codes (draw actor being the most used), and I'm not sure if it would be more useful to post a .ged to download, or post all my code, or if anyone would be willing to lend some advice anyway.
Any direction or suggestions will be appreciated. I will post any code upon request.
Thanks, this is a great community!
As requested, here's the source code.
First, the coding relating to animation in Draw Actor. Most of the animation requests are handled here, as per the "advanced platformer" tutorial:
Here's the code for picking up a rock:
First, the bit in collide with the rock (called "ball" here)
Here;s the bit (repeated from above) when you push down in order to lift the ball up.
Here's what happens when you die. reSpawn is for dying when you still have available hp, reSpawn2 is when you restore to the last savepoint.
This code is in draw actor. It may become a function soon, but it's what causes the view and HUD to move.
That should be most of the relevant parts.
I also have several other functions that dont' seem to have too many problems.
Thanks!
Here's the ged: http://ubuntuone.com/4PkVj9qoAgFls18jbLnxsD
I'm using the examples for "advanced platforming" from the wiki, but have made some tweaks where certain aspects wouldn't work and where I wanted specific things. For example, I wanted to add ladders that you could climb through platforms only when going down and not climb through when at the bottom touching a platform. I have tossable objects (now a ball and a rock), floaty boots, and a few other items. I have a "zelda-style" scrolling background and levels with names.
Unfortunately, here are some of the errors:
- Running animation freezes and does not play
This only started recently. Climbing and jumping work fine, but running just freezes. I am using the example from the wiki, but nothing I do will make him animate.
- Character "stutters" when standing by a ladder and attempting to climb - this is a byproduct of how I've handled ladders, but I can't figure out a way to fix it. I've tried a lot of things, none of which work.
- When scrolling in mid-air (jumping from one screen to the next), the character flies at a violent rate. The same occurs when respawning from one level to another while jumping. You just fly off screen and die a second time. I have told the game "if hdir == 2" (jumping), that you stop, but it doesn't do anything different.
-When dying in a new room immediately after a scroll, you often get stuck with the view looking toward an empty room, not the room you respawned in. I even forced it to appear where you respawn. The view flickers and then returns to the wrong room.
- For no reason I can find, the character can no longer pick up rocks unless he's picked up a ball first. The codes are independent of each other (except for specifying they can't happen at the same time), and I haven't changed the code for those two objects--and yet, I can't pick up rocks any more.
I know none of this is solvable without the code, but there are many codes (draw actor being the most used), and I'm not sure if it would be more useful to post a .ged to download, or post all my code, or if anyone would be willing to lend some advice anyway.
Any direction or suggestions will be appreciated. I will post any code upon request.
Thanks, this is a great community!
As requested, here's the source code.
First, the coding relating to animation in Draw Actor. Most of the animation requests are handled here, as per the "advanced platformer" tutorial:
- Code: Select all
if (key[KEY_DOWN]==1) {
if ( strcmp(special, "carry") != 0) {
if ((vdir == 1) && (ladderon == 0)) {
vdir = 0;
strcpy (action, "lift");
tspeed = 0;
}
else if ((vdir == 2) && (ladderon == 0)){
vdir = 0;
strcpy (action, "lift");
tspeed=speed;
}
if (ladderon == 1){
strcpy (action, "climb");
Ed.y += 3;
tspeed=1;
vdir = 1;
}
}
}
if (key[KEY_UP]==1) {
if ((vdir != 0) && (ladderon == 1)){
vdir = 1;
strcpy (action, "climb");
Ed.y -= 3;
tspeed=1;
}
}
if ((key[KEY_SPACE] == 1) && (vdir!= 2)) {
ladderon = 0;
if (gravway == 1) {
Ed.xvelocity = jump*gravity;
strcpy (action, "jump");
jump = 0;
vdir = 2;
}
else if (gravway == 2) {
Ed.xvelocity = jump*gravity*-1;
strcpy (action, "jump");
jump = 0;
vdir = 2;
}
else if (gravway == 3) {
yvelocity = gravity*jump;
strcpy (action, "jump");
jump = 0;
vdir = 2;
}
else if (gravway == 4) {
Ed.yvelocity = jump*gravity*-1;
strcpy (action, "jump");
jump = 0;
vdir = 2;
}
}
if (key[KEY_LEFT]==1) {
hdir =1;
if ((vdir==0) && (ladderon == 0)) {
tspeed*=-1;
}
else if ((vdir==0) && (ladderon == 1)) {
tspeed=-speed;
ladderon = 0;
}
else if ((vdir>0) && (ladderon == 1)) {
tspeed=-speed;
ladderon = 0;
}
else if ((vdir>0) && (ladderon == 0)) {
tspeed=-speed;
strcpy (facing, "left");
strcpy (action, "run");
}
}
if (key[KEY_RIGHT]==1) {
hdir =0;
if ((vdir==0) && (ladderon == 0)) {
tspeed*=1;
}
else if ((vdir==0) && (ladderon == 1)) {
tspeed=speed;
ladderon = 0;
}
else if ((vdir>0) && (ladderon == 1)) {
tspeed=speed;
ladderon = 0;
}
else if ((vdir>0) && (ladderon == 0)) {
tspeed=speed;
strcpy (facing, "right");
strcpy (action, "run");
}
}
sprintf(anim, "%s%s%s%s", "player", special, action, facing);
if ((vdir==1) && (tspeed!= 0)) {
if ((xvelocity==0) && (prevdir!=hdir)) {
ChangeAnimation ("Ed", anim, FORWARD);
}
else {
ChangeAnimation ("Ed", anim, NO_CHANGE);
}
}
else {
ChangeAnimation ("Ed", anim, STOPPED);
animpos = 0;
}
Here's the code for picking up a rock:
First, the bit in collide with the rock (called "ball" here)
- Code: Select all
char * key = GetKeyState();
if (ladderon!=1) {
if (carrynumber == 49) {
if (key[KEY_DOWN]==1) {
if (item != 0) {
dEquip ();
}
if ((strcmp(facing, "right") == 0)) {
ChangeAnimation("Ed", "playernormalliftright", FORWARD);
ChangePath("Collide Actor", "liftright", BOTH_AXIS);
prevgravity = gravity;
item = 2;
ChangeAnimation("feathericon", "carryicon", FORWARD);
powerlevel = 1;
gravity +=4;
carrynumber = 0;
carried[0] = 5;
}
else if ((strcmp(facing, "right") != 0)) {
ChangeAnimation("Ed", "playernormalliftleft", FORWARD);
ChangePath("Collide Actor", "liftleft", BOTH_AXIS);
prevgravity = gravity;
item = 2;
ChangeAnimation("feathericon", "carryicon", FORWARD);
powerlevel = 1;
gravity +=4;
carrynumber = 0;
carried[0] = 5;
}
}
}
}
Here;s the bit (repeated from above) when you push down in order to lift the ball up.
- Code: Select all
if (key[KEY_DOWN]==1) {
if ( strcmp(special, "carry") != 0) {
if ((vdir == 1) && (ladderon == 0)) {
vdir = 0;
strcpy (action, "lift");
tspeed = 0;
}
else if ((vdir == 2) && (ladderon == 0)){
vdir = 0;
strcpy (action, "lift");
tspeed=speed;
}
if (ladderon == 1){
strcpy (action, "climb");
Ed.y += 3;
tspeed=1;
vdir = 1;
}
}
}
Here's what happens when you die. reSpawn is for dying when you still have available hp, reSpawn2 is when you restore to the last savepoint.
- Code: Select all
void reSpawn ()
{
hitpoints -=1;
hitPointcheck ();
loadVars ("autosave.sav", "input");
loadVars ("autosave.sav", "flags");
loadVars ("autosave.sav", "counters");
loadVars ("autosave.sav", "move");
heartCheck ();
if (hitpoints > (hearttotal +1)) {
hitpoints = hearttotal+1;
}
Ed.x = spawnpoint.x;
Ed.y = spawnpoint.y;
screenmoving = 0;
ChangeAnimation("Ed", "playernormalrespawnright", FORWARD);
view.x = viewcheckpointx;
view.y = viewcheckpointy;
}
void reSpawn2 ()
{
hitpoints -= 1;
hitPointcheck ();
if (fileslot == 1) {
loadVars ("savepoint1.sav", "input");
loadVars ("savepoint1.sav", "flags");
loadVars ("savepoint1.sav", "counters");
loadVars ("savepoint1.sav", "move");
}
if (fileslot == 2) {
loadVars ("savepoint2.sav", "input");
loadVars ("savepoint2.sav", "flags");
loadVars ("savepoint2.sav", "counters");
loadVars ("savepoint2.sav", "move");
}
if (fileslot == 3) {
loadVars ("savepoint3.sav", "input");
loadVars ("savepoint3.sav", "flags");
loadVars ("savepoint3.sav", "counters");
loadVars ("savepoint3.sav", "move");
}
screenmoving = 0;
hitpoints = hearttotal + 1;
heartCheck ();
hitPointcheck ();
Ed.x = spawnsavepoint.x;
Ed.y = spawnsavepoint.y;
ChangeAnimation("Ed", "playernormalrespawnright", FORWARD);
spawnpoint.x = spawnsavepoint.x;
spawnpoint.y = spawnsavepoint.y;
view.x = viewsavex;
view.y = viewsavey;
}
void edgeMove ()
{
Ed.yvelocity = velocityyprev;
Ed.xvelocity = velocityxprev;
if (screenmoving == 1) {
if (vdir != 2) {
Ed.x += 15;
}
if (vdir == 2) {
Ed.x += 15;
}
}
if (screenmoving == 2) {
if (vdir != 2) {
Ed.x -= 15;
}
if (vdir == 2) {
Ed.x -= 15;
}
}
if (screenmoving == 3) {
Ed.y -= 9;
if (iwasclimbingstupid == 1) {
ladderon = 1;
iwasclimbingstupid = 0;
}
}
if (screenmoving == 4) {
Ed.y += 7;
if (iwasclimbingstupid == 1) {
ladderon = 1;
iwasclimbingstupid = 0;
}
}
}
This code is in draw actor. It may become a function soon, but it's what causes the view and HUD to move.
- Code: Select all
if (Ed.x > (screenedge.x +618)) {
if (screenmovetimer == 0) {
MoveTo("screenedge", 640.000000, 0.000000, 11.000000, "screenedge", "");
MoveTo("heart.1", 640.000000, 0.000000, 11.000000, "heart.1", "");
MoveTo("heart.2", 640.000000, 0.000000, 11.000000, "heart.2", "");
MoveTo("heart.3", 640.000000, 0.000000, 11.000000, "heart.3", "");
MoveTo("heart.4", 640.000000, 0.000000, 11.000000, "heart.4", "");
MoveTo("heart.5", 640.000000, 0.000000, 11.000000, "heart.5", "");
MoveTo("heart.6", 640.000000, 0.000000, 11.000000, "heart.6", "");
MoveTo("heart.7", 640.000000, 0.000000, 11.000000, "heart.7", "");
MoveTo("heart.8", 640.000000, 0.000000, 11.000000, "heart.8", "");
MoveTo("heart.9", 640.000000, 0.000000, 11.000000, "heart.9", "");
MoveTo("heart.0", 640.000000, 0.000000, 11.000000, "heart.0", "");
MoveTo("credit", 640.000000, 0.000000, 11.000000, "credit", "");
MoveTo("Falltimer", 640.000000, 0.000000, 11.000000, "Falltimer", "");
MoveTo("falltimer2", 640.000000, 0.000000, 11.000000, "falltimer2", "");
MoveTo("falltimer3", 640.000000, 0.000000, 11.000000, "falltimer3", "");
MoveTo("feathericon", 640.000000, 0.000000, 11.000000, "feathericon", "");
MoveTo("healthmeter", 640.000000, 0.000000, 11.000000, "healthmeter", "");
MoveTo("Inventory", 640.000000, 0.000000, 11.000000, "Inventory", "");
MoveTo("levelname", 640.000000, 0.000000, 11.000000, "levelname", "");
velocityyprev = Ed.yvelocity;
velocityxprev = Ed.xvelocity;
yvelocity = 0;
xvelocity = 0;
screenmoving = 1;
level += 1;
viewlevel += 1;
levelLoad ();
screenmovetimer = 70;
EventDisable("Ed", EVENTANIMATION);
}
}
if (Ed.x < screenedge.x - 8) {
if (screenmovetimer == 0) {
MoveTo("screenedge", -640.000000, 0.000000, 11.000000, "screenedge", "");
MoveTo("heart.1", -640.000000, 0.000000, 11.000000, "heart.1", "");
MoveTo("heart.2", -640.000000, 0.000000, 11.000000, "heart.2", "");
MoveTo("heart.3", -640.000000, 0.000000, 11.000000, "heart.3", "");
MoveTo("heart.4", -640.000000, 0.000000, 11.000000, "heart.4", "");
MoveTo("heart.5", -640.000000, 0.000000, 11.000000, "heart.5", "");
MoveTo("heart.6", -640.000000, 0.000000, 11.000000, "heart.6", "");
MoveTo("heart.7", -640.000000, 0.000000, 11.000000, "heart.7", "");
MoveTo("heart.8", -640.000000, 0.000000, 11.000000, "heart.8", "");
MoveTo("heart.9", -640.000000, 0.000000, 11.000000, "heart.9", "");
MoveTo("heart.0", -640.000000, 0.000000, 11.000000, "heart.0", "");
MoveTo("credit", -640.000000, 0.000000, 11.000000, "credit", "");
MoveTo("Falltimer", -640.000000, 0.000000, 11.000000, "Falltimer", "");
MoveTo("falltimer2", -640.000000, 0.000000, 11.000000, "falltimer2", "");
MoveTo("falltimer3", -640.000000, 0.000000, 11.000000, "falltimer3", "");
MoveTo("feathericon", -640.000000, 0.000000, 11.000000, "feathericon", "");
MoveTo("healthmeter", -640.000000, 0.000000, 11.000000, "healthmeter", "");
MoveTo("Inventory", -640.000000, 0.000000, 11.000000, "Inventory", "");
MoveTo("levelname", -640.000000, 0.000000, 11.000000, "levelname", "");
velocityyprev = Ed.yvelocity;
velocityxprev = Ed.xvelocity;
yvelocity = 0;
xvelocity = 0;
screenmoving = 2;
screenmovetimer = 70;
level -= 1;
viewlevel -= 1;
levelLoad ();
EventDisable("Ed", EVENTANIMATION);
}
}
if (Ed.y < screenedge.y - 8) {
if (screenmovetimer == 0) {
if (ladderon == 1) {
iwasclimbingstupid = 1;
}
MoveTo("screenedge", 0.000000, -480.000000, 11.000000, "screenedge", "");
MoveTo("heart.1", 0.000000, -480.000000, 11.000000, "heart.1", "");
MoveTo("heart.2", 0.000000, -480.000000, 11.000000, "heart.2", "");
MoveTo("heart.3", 0.000000, -480.000000, 11.000000, "heart.3", "");
MoveTo("heart.4", 0.000000, -480.000000, 11.000000, "heart.4", "");
MoveTo("heart.5", 0.000000, -480.000000, 11.000000, "heart.5", "");
MoveTo("heart.6", 0.000000, -480.000000, 11.000000, "heart.6", "");
MoveTo("heart.7", 0.000000, -480.000000, 11.000000, "heart.7", "");
MoveTo("heart.8", 0.000000, -480.000000, 11.000000, "heart.8", "");
MoveTo("heart.9", 0.000000, -480.000000, 11.000000, "heart.9", "");
MoveTo("heart.0", 0.000000, -480.000000, 11.000000, "heart.0", "");
MoveTo("credit", 0.000000, -480.000000, 11.000000, "credit", "");
MoveTo("Falltimer", 0.000000, -480.000000, 11.000000, "Falltimer", "");
MoveTo("falltimer2", 0.000000, -480.000000, 11.000000, "falltimer2", "");
MoveTo("falltimer3", 0.000000, -480.000000, 11.000000, "falltimer3", "");
MoveTo("feathericon", 0.000000, -480.000000, 11.000000, "feathericon", "");
MoveTo("healthmeter", 0.000000, -480.000000, 11.000000, "healthmeter", "");
MoveTo("Inventory", 0.000000, -480.000000, 11.000000, "Inventory", "");
MoveTo("levelname", 0.000000, -480.000000, 11.000000, "levelname", "");
velocityyprev = Ed.yvelocity;
velocityxprev = Ed.xvelocity;
yvelocity = 0;
xvelocity = 0;
screenmoving = 3;
screenmovetimer = 50;
level += 10;
viewlevel += 10;
levelLoad ();
EventDisable("Ed", EVENTANIMATION);
}
}
if (Ed.y > screenedge.y + 480) {
if (screenmovetimer == 0) {
if (ladderon == 1) {
iwasclimbingstupid = 1;
}
MoveTo("screenedge", 0.000000, 480.000000, 11.000000, "screenedge", "");
MoveTo("heart.1", 0.000000, 480.000000, 11.000000, "heart.1", "");
MoveTo("heart.2", 0.000000, 480.000000, 11.000000, "heart.2", "");
MoveTo("heart.3", 0.000000, 480.000000, 11.000000, "heart.3", "");
MoveTo("heart.4", 0.000000, 480.000000, 11.000000, "heart.4", "");
MoveTo("heart.5", 0.000000, 480.000000, 11.000000, "heart.5", "");
MoveTo("heart.6", 0.000000, 480.000000, 11.000000, "heart.6", "");
MoveTo("heart.7", 0.000000, 480.000000, 11.000000, "heart.7", "");
MoveTo("heart.8", 0.000000, 480.000000, 11.000000, "heart.8", "");
MoveTo("heart.9", 0.000000, 480.000000, 11.000000, "heart.9", "");
MoveTo("heart.0", 0.000000, 480.000000, 11.000000, "heart.0", "");
MoveTo("credit", 0.000000, 480.000000, 11.000000, "credit", "");
MoveTo("Falltimer", 0.000000, 480.000000, 11.000000, "Falltimer", "");
MoveTo("falltimer2", 0.000000, 480.000000, 11.000000, "falltimer2", "");
MoveTo("falltimer3", 0.000000, 480.000000, 11.000000, "falltimer3", "");
MoveTo("feathericon", 0.000000, 480.000000, 11.000000, "feathericon", "");
MoveTo("healthmeter", 0.000000, 480.000000, 11.000000, "healthmeter", "");
MoveTo("Inventory", 0.000000, 480.000000, 11.000000, "Inventory", "");
MoveTo("levelname", 0.000000, 480.000000, 11.000000, "levelname", "");
velocityyprev = Ed.yvelocity;
velocityxprev = Ed.xvelocity;
yvelocity = 0;
xvelocity = 0;
screenmoving = 4;
screenmovetimer = 50;
level -= 10;
viewlevel -= 10;
levelLoad ();
EventDisable("Ed", EVENTANIMATION);
}
}
}
That should be most of the relevant parts.
I also have several other functions that dont' seem to have too many problems.
Thanks!
- Code: Select all
Here's the ged: http://ubuntuone.com/4PkVj9qoAgFls18jbLnxsD