Page 1 of 1

Help With A Newbies Game

PostPosted: Thu Aug 04, 2011 10:24 pm
by happyjustbecause
Sorry about having to post yet another thing on my probably simple problems, but I am again at a loss! I'm not sure what to do about several things in my game. I have my character able to jump, but I am not sure how to keep the jumping animation when moving left and right in the air. Whenever I move left or right by simply walking he will fall through the tiles. And I am not sure on how to do a shooting animation while walking and have it switch back to the normal walking animation after the shot has been fired...

I am again sorry for looking to the community to help solve my problems, but help would still be greatly appreciated. It's all a learning experience before I am able to make good games anyways right?

Ok, well Thank you very much to anyone willing to help!

:D

Re: Help With A Newbies Game

PostPosted: Thu Aug 04, 2011 11:19 pm
by Camper1995
Hello,

please post data folder everytime you post a .ged file (your game).
The game needs to load from the data folder.

I suggest you zipping (or rarring) Andrewoid.get and data folder. :wink:

Thank you,

(I am able to help you)

Re: Help With A Newbies Game

PostPosted: Fri Aug 05, 2011 1:07 am
by happyjustbecause
Alright, I posted the zipped up data, thanks for wanting to help!

Re: Help With A Newbies Game

PostPosted: Fri Aug 05, 2011 5:39 am
by skydereign
Well to fix the falling through the ground, you have to set the collision event with the PhysicalResponse to repeat when colliding. I would actually suggest you learn the state method to prevent moonwalking and generally fix any animation problems you are having, but that will take a bit of effort on your part. If you are interested pm me, and I can send you the details. For now, this is a demo of what I mean. http://game-editor.com/forum/download/file.php?id=4965

If not, then you'll need a variable to determine the actor's direction, 0 if facing right and 1 if facing left (or similar). That way when you jump, you can check if dir==0 or dir==1, and change the animation accordingly. Also on the keydown right and left events that change the animation, if you put those in script editor, you can check if the actor is jumping, and if so not change the animation (or rather change the animation if the actor is not jumping).
Code: Select all
if(cjump==1)
{
    //ChangeAnimation function call to running
}

Re: Help With A Newbies Game

PostPosted: Fri Aug 05, 2011 1:12 pm
by Camper1995
Damn, Sky was faster. :P

Re: Help With A Newbies Game

PostPosted: Fri Aug 05, 2011 5:10 pm
by foleyjo
The way I did it for Jet Set Wanley was to have 3 states

In state 1 the player was walking and there was no vertical velocity.Player was able to move left and right. There was also a check before each movement to make sure that there was floor underneath the player. To do this I used a collisionfree check. If it was free the player would move to a falling state . If the player pressed space he would move to a jumping state.

In state 2 the player was falling. In the player was unable to move left and right and the player was constantly falling down. yvelocity++. Player could not jump.

In State 3 the player was falling down. Player was unable to jump. If player was moving left or right as they jump, the player would constantly move in that direction.

If the player collided with the floor in states 2 or 3 there would be a physicalresponce and then state would change to state 1.

Also using this method I did not need to use a can jump variable.

Re: Help With A Newbies Game

PostPosted: Fri Aug 05, 2011 7:54 pm
by happyjustbecause
Thanks for the help everyone! But I also forgot to put: How do I have it so that I can change the shooting direction depending on the direction the character is facing. That way its not always going to the right. (Face Right, Shoot Right. Face Left, Shoot Left).

Re: Help With A Newbies Game

PostPosted: Fri Aug 05, 2011 8:00 pm
by skydereign
Well if you add the dir variable you can do this for your attack button.
player -> Key Down Space -> Script Editor
Code: Select all
if(dir==0) // right
{
    CreateActor("bullet", "bullet_anim", "(none)", "(none)", 0, 0, false)->xvelocity=10;
}
else
{
    CreateActor("bullet", "bullet_anim", "(none)", "(none)", 0, 0, false)->xvelocity=-10;
}


To make the actual dir variable work, make sure to have on your keydown right script, set dir to 0, and on your keydown left script set it to 1. Then the above code should work. Also not that the speed that the bullet moves is determined by the above code (the 10), so if you have the xvelocity code in the bullet's create actor, remove it. However you can use 1 and -1 if you don't like using ifs (xvelocity*dir).

Re: Help With A Newbies Game

PostPosted: Fri Aug 05, 2011 10:25 pm
by foleyjo
do it without the if and have dir = 1 or -1 , then make xvelocity = 10 * dir

i've been reading the thread about data control