Hi all... I've got a serious problem with an old-skool type platformer game I'm making. In the game, I have the relatively dumb enemies jump before a wall or pit.
This part works fine... however... I have set them to jump really far over a large pit. Still, it's all fine. Now, my problem is that when they reach the peak of a long jump, they suddenly die. I have no idea what is causing this problem. I've scoured the code over and over, but I just can't figure it out. If anybody wants to help out, DC Mail me with your email address and I'll send you the game (unprotected). Thanks in advance,
KJ
won't you look up at the skyline
at the mortar, block, and glass
and check out the reflections in my eyes?
you see they always used to be there
even when this all was grass
and I sang and danced about a high-rise
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G
The enemies have a special dying sequence where they slide away from what killed them, falling over and sinking into the ground (sinking as in a few rows of pixels vanishing at a time, not actually moving downwards). What happens is that at the peak of the enemy's jump, as he moves down, he just begins his dying sequence. When he hits the platform, he goes right through it and off screen. I don't know if they run out of health or what. I still can't figure out why this happens. Let me go into detail about the alterable values.
The enemy's Value A represents health. When it reaches 3 or higher, the enemy's death sequence begins.
The enemy's Value B represents horizontal force, such as being knocked back by an attack or sliding along the ground in death.
The enemy's Value C represents vertical force, such as gravity. A positive value moves him upwards, and a negative value moves him downwards.
Here is the jumping code:
Line 1 Conditions:
-(Enemy) is overlapping (enemy jump here[an object that triggers an enemy's jump])-
-(Enemy) animation Disappearing is NOT playing-
-(Enemy) animation Hurt is NOT playing-
-(Enemy) internal flag 4 is off- [flag 4 designates that Enemy is jumping upwards]-
-(Enemy) internal flag 5 is off- [flag 5 designates that Enemy is falling downwards]-
Line 1 Actions:
=(Enemy) set alterable value C to 11=
=(Enemy) set internal flag 4 on=
=(Enemy) set internal flag 6 on= [flag six designates that Enemy is in midair]
Line 2 Conditions:
-(Enemy) alterable value C is greater than 0-
Line 2 Actions:
=(Enemy) subtract 1 from alterable value C=
=(Enemy) set -Y pos- to -Y pos- minus alterable value C=
Line 3 Conditions:
-(Enemy) alterable value C is 0-
-(Enemy) internal flag 4 is on-
Line 3 Actions:
=(Enemy) set internal flag 4 off=
=(Enemy) set internal flag 5 on=
Line 4 Conditions:
-(Enemy) internal flag 5 is on-
Line 4 Actions:
=(Enemy) set -Y pos- to -Y pos- minus alterable value C=
=(Enemy) subtract 1 from alterable value C=
Line 5 Conditions:
-(Enemy) alterable value C is less than -6 -
Line 5 Actions:
=(Enemy) set alterable value C to -6=
Line 6 Conditions:
-(Enemy) collides with background
-(Enemy) internal flag 5 is on
Line 6 Actions:
=(Enemy) set alterable value C to 0=
=(Enemy) set internal flag 5 off=
=(Enemy) set internal flag 6 off=
That's the jumping code. For some reason the dude dies at the peak of his jump! But nothing happens to kill him anywhere in the code besides his value A hitting 3 or higher... and I scoured it totally, finding nothing that would cause this...
Oh. My. God. No way... Okay... I found it... well, this is hilariously idiotic. Let me explain what the cause was (laughs... then cries)...
At the start of development, the enemy died after his X position was greater than 260, because he was offscreen. There was only 1 screen back then. Now there are two screens. Turns out X coordinant 260 is the peak of his jump over that one pit. Sorry for bothering people... but what the hell! N00bs can see some of my code and use it, I guess. Thanks for your offers of help, guys.
Edited by the Author.
won't you look up at the skyline
at the mortar, block, and glass
and check out the reflections in my eyes?
you see they always used to be there
even when this all was grass
and I sang and danced about a high-rise
Pete Nattress Cheesy Bits img src/uploads/sccheesegif