How to 'walk'

Learn how to start making games.

How to 'walk'

Postby millepix » Mon Apr 03, 2017 4:17 pm

Hello, I have no programming background. I just (yesterday) started learning C - and I have been playing around with game-editor for a while.

I am eager to get an actor (hero/main character 'person') to 'walk' though. I was wondering is there many different ways to acheive this same effect. I've come to realize in coding it's sort of like that - different ways to solve a problem.

I have gotten to the point where I have added 4 animations to an actor - stop left/walk left/stop right/walk right.

And I realize that next comes events - ie when key down (arrow left or arrow right) is pushed I would want to change the animation from stop left or right to walk left or right accordingly.

Can I do this by just assigning via buttons or do I have to use a script? (I'm not sure what a script is btw - how it aids the programming outside of the buttons I can select).

Is there a 'template' for 'walking' a character? certain simple steps to follow?

Hope this make some sense.

Thank you.
millepix
 
Posts: 12
Joined: Tue Jan 24, 2017 3:44 am
Score: 0 Give a positive score

Re: How to 'walk'

Postby juansimat » Mon Apr 03, 2017 6:38 pm

Yes, you have a lot of options.
I don't know if you are familiar with what's known as state machine. You will need to make a system using keydown events or draw actor, and script to change Animation as well as the position/velocity of the actor, do collision and that's the basic.

You can enter to your gameEditor folder, and inside the Tutorials folder you can take a look at caveman.ged to see a simple way.
Also search on the forums the different ways it can be done to animate an actor so you can learn more.
And to finish, you can find tutorials in YouTube made by our great community :P

BTW, welcome to Game Editor.
̿̿¯̿̿¯̿̿'̿̿̿̿̿̿̿'̿̿'̿̿̿̿̿'̿̿̿)͇̿̿)̿̿̿̿ '̿̿̿̿̿̿\̵͇̿̿\з=(๏̯͡๏)=ε
User avatar
juansimat
 
Posts: 152
Joined: Sat Dec 19, 2009 8:23 am
Score: 27 Give a positive score

Re: How to 'walk'

Postby millepix » Tue Apr 04, 2017 3:24 pm

Thank you for the input. I never realized while playing games how many different ways the character I was playing was walking! There seems to be some games that move the background not the character; others move like in the caveman tutorial and more - I'm paying much more attention now!

One thing I wondered - what does the 'repeat' part do to the event? For example: if I have 2 animations - one standing facing right (single image); the other walking right (a sequence of images making up the animation) If I add the event on a key down to change the animation to walking from standing different things happen depending on if I select enable or disable for the 'repeat' option.

If I leave repeat enabled - then the result is that when I press the down key the walking looks speeded up. Whereas if I select disable, the walking proceeds at the frame rate specified.

What does the repeat do in terms of - what is it telling the computer to do?

And as an off topic question - is it possible to use sheets of images - like sprite sheets (think that's the name)? I have loaded one row of images and it worked fine but if I load a sheet the whole sequence plays so I'll see front, righside, leftside, back etc - to the end of the sheet. Is it possible to use sprite sheets in game-editor?

Thank you! :)
millepix
 
Posts: 12
Joined: Tue Jan 24, 2017 3:44 am
Score: 0 Give a positive score

Re: How to 'walk'

Postby juansimat » Tue Apr 04, 2017 4:29 pm

millepix wrote:One thing I wondered - what does the 'repeat' part do to the event? For example: if I have 2 animations - one standing facing right (single image); the other walking right (a sequence of images making up the animation) If I add the event on a key down to change the animation to walking from standing different things happen depending on if I select enable or disable for the 'repeat' option.

If I leave repeat enabled - then the result is that when I press the down key the walking looks speeded up. Whereas if I select disable, the walking proceeds at the frame rate specified.

What does the repeat do in terms of - what is it telling the computer to do?


Ok this is a commom beginer mistake.
First, the repeat enabled, makes that the event is repeated every frame as long as the key is hold down (as a hint, you can hover the mouse above that to see a title explaining that), if disable, it only triggers the first time you press (on key down event). So use this depending on your needs.
The other problem is that in the "ChangeAnimation" action, if you select direction "forward", it causes the animation to reseting. As a rule of thumb: If you are not chaning the animation direction (Don't using backward or stopped), you can set it to "no change", and as long as it's not set to stopped, the animation will still playing (and all that you change into) without reseting the animation to frame 0.

millepix wrote:And as an off topic question - is it possible to use sheets of images - like sprite sheets (think that's the name)? I have loaded one row of images and it worked fine but if I load a sheet the whole sequence plays so I'll see front, righside, leftside, back etc - to the end of the sheet. Is it possible to use sprite sheets in game-editor?


Yes you can use sprite sheets, but the frames must be equal in size (i.e. cannot use a xml parser that holds the coordinates of each frame). When add animation you can specify the number of rows and columns it has. You also can use gif, or multiple frames (switching from single file to multiple files, and having them with number suffix) that this time can be different sized.
But what seeing you are trying to accomplish. When adding a sprite sheet that contains different sets of animations you want to use, there's something called as sequence inside gameEditor, you can add that "atlas" with all the frames, and create sequences that contain the ones you want for the specific animation (note that the index always start by 0; 0 is the first frame).
̿̿¯̿̿¯̿̿'̿̿̿̿̿̿̿'̿̿'̿̿̿̿̿'̿̿̿)͇̿̿)̿̿̿̿ '̿̿̿̿̿̿\̵͇̿̿\з=(๏̯͡๏)=ε
User avatar
juansimat
 
Posts: 152
Joined: Sat Dec 19, 2009 8:23 am
Score: 27 Give a positive score

Re: How to 'walk'

Postby millepix » Thu Apr 06, 2017 2:25 am

Thank you for the information about enable/disable in changing animation. That makes sense and it's nice to not have my actor/characters running frantically all the time! :D

The other problem is that in the "ChangeAnimation" action, if you select direction "forward", it causes the animation to reseting. As a rule of thumb: If you are not chaning the animation direction (Don't using backward or stopped), you can set it to "no change", and as long as it's not set to stopped, the animation will still playing (and all that you change into) without reseting the animation to frame 0.


I tried 2 characters - one with 'no change' and one with 'forward' setting but didn't see a difference. The character with 'forward' didn't seem to reset but maybe it depends on the animation whether or not I would notice?

Yes you can use sprite sheets, but the frames must be equal in size (i.e. cannot use a xml parser that holds the coordinates of each frame). When add animation you can specify the number of rows and columns it has.

That makes sense in terms of what I've seen in sprite sheets, thank you. I've seen some sheets where images are spaced equally across and down the page - grid like - but others have images all over the page! It's good to know what can be used in game-editor. I think positions of images would be easier to figure out visually with an equally spaced grid.

You also can use gif, or multiple frames (switching from single file to multiple files, and having them with number suffix) that this time can be different sized.


Do you mean I could have a gif already made up and just add that as an animation? Not having to separate the pngs that made up the gif? I used a gif that way would I call it multiple file even though it's sort of looks like a single file on my computer - eg filename.gif
Or do I just use multiple file when I have the situation of image01.png . . . image10.png?

I have tried the last thing - image01.png . . . - and it works wonderfully! I managed to animate a small 'waterfall' that way today - :lol: great fun!

But what seeing you are trying to accomplish. When adding a sprite sheet that contains different sets of animations you want to use, there's something called as sequence inside gameEditor, you can add that "atlas" with all the frames, and create sequences that contain the ones you want for the specific animation (note that the index always start by 0; 0 is the first frame).


I will keep this in mind. It seems useful in terms of file size if I can have images on a sheet and pick and choose through a sequence since sometimes the images can repeat in different animations.

I am going to try out collisions next - I was thinking of jumps and tried some with using just scripts that changed the and and y value but something was missing. I saw from the jump help page that it needs a collision so I think that is next before jumping.
millepix
 
Posts: 12
Joined: Tue Jan 24, 2017 3:44 am
Score: 0 Give a positive score

Re: How to 'walk'

Postby juansimat » Thu Apr 06, 2017 8:21 am

A single gif file is a single animation, because that filetype can have more frames. But if you use the file as a spritesheet (horizontal and vertical frames > 1) or multi files it only uses the first frame of the gif. If already has no more frames, it's fine

If its a platform, as you can learn from the caveman demo, you need gravity (achieved with yvelocity) the jump should change yvelocity too, and collision, of course, to avoid the actor falls throught the scenario.

Go ahead and have fun. :D
̿̿¯̿̿¯̿̿'̿̿̿̿̿̿̿'̿̿'̿̿̿̿̿'̿̿̿)͇̿̿)̿̿̿̿ '̿̿̿̿̿̿\̵͇̿̿\з=(๏̯͡๏)=ε
User avatar
juansimat
 
Posts: 152
Joined: Sat Dec 19, 2009 8:23 am
Score: 27 Give a positive score


Return to Getting Started

Who is online

Users browsing this forum: No registered users and 1 guest