supatails wrote:Oh the reason for the squish variable is to determine if floober has the ability to go into the squish states. As you can see from the demo, when floober collects the powerup (that ball on top of the pole), he is able to squish, because collision with the powerup sets squish to 1 and then destroys the powerup
Ah, well I didn't actually look at your game. I just looked at bits of the player's code that seemed relevant. Looking at it now though, here is a tip.
This is what you have.
- Code: Select all
DestroyActor("cheat_squish1");
squish=1;
That will destroy all cheat_squish1 actors. To test this, just create two of them close to each other. Bump into one of them, and both of them will be destroyed. That is because that code is telling you to destroy the cheat_squish1 actor (of which there are two). What you want to tell gE is to destroy the actor you are colliding with. Instead of "cheat_squish1" you can use "Collide Actor" to specify just the actor you are colliding with (this is similar to specifying "Event Actor").
Another thing I forgot to mention is you are using if statements incorrectly. You have in your keydown down event a chunk of code that looks similar to this.
- Code: Select all
if(squish==1)
ChangeAnimation(...);
state=6;
if(squish==0)
state=0;
There are two things wrong with that. The first is you need brackets when using an if statement that has more than one action.
- Code: Select all
// for example
if(state==0)
state=2;
state=3;
This no matter what state is equal to will change state to 3. This is because the if statement only applies to the one action after (setting state equal to 2). So even if state isn't equal to 0, state will be set equal to 3. To fix this use {} when dealing with if statements. Also, do you know about else if?
- Code: Select all
if(state==0)
{
state=2; // now it is obvious (and correct) that both of these are bound by the if
state=3;
}
In your code though it is kind of fixed, because state will be set equal to 6 no matter what, but it will be set to 0 if squish is equal to 0.
The other thing about your code is you shouldn't change state without changing the animation. If you are running (state equal to 2), and you press down, your player will continue having the run animation, but its state will be set to 0. Again this doesn't cause any bugs in your game due to some lucky other part "fixing" the mistake. But you should avoid relying on accidental fixes.
supatails wrote:1. I need to restrict the ability to pop out of the squish states if there is no room. At the moment you can slide under the small gap, but you are able to pop back up while underneath it and glitch on top of the platform. I'm stuck on how to get around this problem.
This can be rather weird to fix. One way is to use the CollisionFree method. This will work if you don't have any other actors with enabled collision states that could get in the way. This is the method though that would make the most sense. Since you are learning gE I recommend you look up CollisionFree on this page.
http://game-editor.com/docs/script_reference.htmIt helps to get in the habit of looking things up on that page. If you still need help with implementing it, I can provide more detail on it.
supatails wrote:2. Occasionally but not always, when you go in and out of the squish states, especially while in motion, the "squish" and "shlop" animations play extra frames or something, making it look buggy and jerky. Is there a way around the weird, somewhat rare occurance?
Try changing the FORWARD to NO_CHANGE in the ChangeAnimation function calls.
One other thing I thought I should mention. In global code you have a bunch of one line scripts declaring different variables. They don't have to each have their own script. You could make a single one with all the variables there.
- Code: Select all
int state;
int squish;
int evo;