Camper's school for all :-]

Post here your demos and examples with the source files.
Forum rules
Always post the games with a screenshot.
The file must have the ged and data files (complete game source)
Use the forum attachment to post the files.
It is always better to use the first post to put the game files

Camper's school for all :-]

Postby Camper1995 » Sun Feb 22, 2009 10:35 am

Hi people, I think, newbies need help with a lot of things, and one of that thing is, saving and loading game
So, I have made this demo of saving and loading game... so

I hope it helps

Move your actor with arrows.
SAVING GAME.JPG


Here is file:
saving game.zip
(29.63 KiB) Downloaded 362 times



Enjoy :D
Last edited by Camper1995 on Sun Feb 22, 2009 1:36 pm, edited 1 time in total.
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Examples 4 All

Postby Camper1995 » Sun Feb 22, 2009 1:14 pm

Next example is, gravitation. I made this demo, USE number 1 2 3 and 4
to change gravitation...

Move your actor with arrows: LEFT, RIGHT, UP, DOWN
GRAVITATION.JPG


Gravitation Example.zip
(195.54 KiB) Downloaded 212 times
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Examples 4 All

Postby Camper1995 » Sun Feb 22, 2009 1:26 pm

Next example for newbies... jumping...
all is explained in GE... ;-]

Use arrow keys to move
Jumping FOTO.JPG


Jumping.zip
(1.48 KiB) Downloaded 202 times
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Camper's school for all :-]

Postby Camper1995 » Sun Feb 22, 2009 1:39 pm

Ok, next example is easy way to make a HP bar.. :D

Move your player with arrow keys
HP.JPG


HP.zip
(4.85 KiB) Downloaded 192 times
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Camper's school for all :-]

Postby Camper1995 » Sun Feb 22, 2009 1:52 pm

Yo, next is this. Makin a save and start position... So... :D

Just try it and you will see..
Hole.JPG


Hole.zip
(229.22 KiB) Downloaded 196 times
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Camper's school for all :-]

Postby Camper1995 » Sun Feb 22, 2009 1:54 pm

So, I think, this is the basic for start to build a good game...

Yo, next problem is moonwalikng, but I dont know how to do antimoonwalking..

jimmynewguy has explain me that, but, its too complicated :D


ENJOY :D
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Camper's school for all :-]

Postby LucasA33 » Sun Feb 22, 2009 8:11 pm

Nice work.
LucasA33
 
Posts: 79
Joined: Mon Jul 21, 2008 12:17 am
Location: Science, Technology, Computers, Programming, and Robotics.
Score: 1 Give a positive score

Re: Camper's school for all :-]

Postby skydereign » Sun Feb 22, 2009 8:12 pm

Platformer antimoonwalking is actually pretty easy. This may seem long, but it is the same logic for all of the scripts. I just put them all there. I'll elaborate on the way jimmynewguy showed you. Since you have two possible directions, you can use a variable called direction. Upon keydown left, set it to 0, upon keydown right, set it to 1. Upon those keydowns, you must switch the animation, depending on if left, right, or both keys are pressed.
KeyDown(Right)[Disable repeat]->Script Editor
Code: Select all
char* key=GetKeyState(); // Allows keyboard interaction (key[KEY_<your key here>]) is either 1 or 0
if (canjump==1) // if actor is on the ground
{
    if (key[KEY_LEFT] == 0 && key[KEY_RIGHT] == 1) // If only right is pressed (allow for walking, so change animation)
    {
        ChangeAnimation("Event Actor", "WalkRight", FORWARD); // Because only right is pressed, change to walking
    }
    else if (key[KEY_LEFT] == 1 && key[KEY_RIGHT] == 1) // If both right and left (don't allow for walking, stand animation)
    {
        ChangeAnimation("Event Actor", "Right", FORWARD); // Because both are pressed
    }
}
right=1; // right


KeyDown(Left)[Disable repeat]->Script Editor
Code: Select all
char* key=GetKeyState();
if (canjump==1)
{
    if (key[KEY_LEFT] == 1 && key[KEY_RIGHT] == 0)
    {
        ChangeAnimation("Event Actor", "WalkLeft", FORWARD);
    }
    else if (key[KEY_LEFT] == 1 && key[KEY_RIGHT] == 1)
    {
        ChangeAnimation("Event Actor", "Left", FORWARD);
    }
}
direction=0; // left

Right and left are to determine jump animations, or any other that you may put in. The reasoning for this is you need to make sure that the actor knows which way it's facing. Since the event is not repeated, the last keydown will define the direction.
Now for the keyup. These follow almost identical logic for sorting which direction to go as above. The only difference is due to the nature of keyup. Since that is an event triggered by a switch from 1 to 0, the conditions will change. If left is still pressed than walk. If both are released set it to stand.
KeyUp(Right)->Script Editor
Code: Select all
char* key=GetKeyState();
if (canjump==1)
{
    if (key[KEY_LEFT] == 1 && key[KEY_RIGHT] == 0) // If left is still pressed, walk left
    {
        ChangeAnimation("Event Actor", "WalkLeft", FORWARD);
    }
    else if (key[KEY_LEFT] == 0 && key[KEY_RIGHT] ==0)  // As left and right are not pressed, set it to stand
    {
        ChangeAnimation)"Event Actor", "Right", FORWARD);
    }
}


KeyUp(Left)->Script Editor
Code: Select all
char* key=GetKeyState();
if (canjump==1)
{
    if (key[KEY_LEFT] == 0 && key[KEY_RIGHT] == 1)
    {
        ChangeAnimation("Event Actor", "WalkRight", FORWARD);
    }
    else if (key[KEY_LEFT] == 0 && key[KEY_RIGHT] == 0)
    {
        ChangeAnimation)"Event Actor", "Left", FORWARD);
    }
}



The last bit is in the draw actor. This will set your movement, only if a single key is pressed.
DrawActor->Script Editor
Code: Select all
char* key=GetKeyState();
if (key[KEY_LEFT] == 1 && key[KEY_RIGHT] == 0) // Only left
{
    x- = 2;  // Move left
}
if (key[KEY_LEFT] == 0 && key[KEY_RIGHT] == 1) // Only right
{
    x+= 2;  // Move right
}
yvelocity+=9; // Because this is the draw actor script, nothing to do with moonwalking
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Camper's school for all :-]

Postby Camper1995 » Mon Feb 23, 2009 10:15 am

Ou man, Thanks man... :D I understand it now.. but I have only one question...

Example: I have a character, and I am making a figting game.. so.. when I press SPACE BAR, character will attack (punch)
but......man...do you have play my game: Crash The Bandicoot?

Download it, and there, when I attack and in same time I run...how can I do this: So when I press spacebar when I am running, when the animation
of attacking is finish, the character will run..so, he dont stop...

I cant explain it, because I cant speak good english, but try that game, and you will understand that problem with moonwalking when the player is attacking..


THANKS :D :D :D
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Camper's school for all :-]

Postby skydereign » Tue Feb 24, 2009 2:02 am

Well depending on what you are doing, or how complex you are going with the attacks, there are several ways. I think what you are asking is how to stop movement during an attack. If so, you would create a variable signifying the attack is being done, and when it finishes you set the variable back to 0. So when you press space, or your attack button, set attack to 1. Upon the animation finish, reset it to 0. Now during your draw actor script that creates movement, only allow movement if attack is 0. This can be done with an if statement,
Code: Select all
if (attack==0)

I looked at your game, but you made it a lot harder to make changes. When I make a game, I try to make the fewest amount of events as possible, for the most part this is a good thing to do (sometimes not), but it makes it much easier to edit. Most of your keydowns have many events, all of them are possible in the script editor, such as ChangeAnimation. At first I did that too, but if it is to separate the functionalities of your code, you can comment them with //, or separate them... or both. Just a tip, it makes it much easier for others and yourself to edit and revise. I no longer use keydown events as I have created an alternative to doing so, it is arguable if that is a good thing that I have 3 or so events only, but I prefer it, especially because I edit all my scripts externally...
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Camper's school for all :-]

Postby Camper1995 » Tue Feb 24, 2009 12:23 pm

Yea yea,... :-))) Um, only, is this script good?:
Code: Select all
if(respect.textNumber == 9)
{
   Event Enable...
   Change Animatio....
}


I want to do this: When is Respect.textNumber bigger then number 9, enable doors, so you can enter in a building...

Is this good?
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Camper's school for all :-]

Postby skydereign » Tue Feb 24, 2009 11:52 pm

Yeah, I would just set it to > instead of ==, if you want greater than 9.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Camper's school for all :-]

Postby Camper1995 » Wed Feb 25, 2009 7:04 pm

Yeah
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score


Return to Game Demos

Who is online

Users browsing this forum: No registered users and 1 guest