online game

Game Editor comments and discussion.

online game

Postby praaab » Fri Jun 24, 2011 4:17 pm

ok i have a few questions on my game that im creating. 1. how do i make my game online, like to make other people play against eachother. 2. how do i make my character shoot from the side hes facing because he only shoots on the right side. 3. how do i create an ai with gravity and shoot.
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score

Re: online game

Postby MrJolteon » Sat Jun 25, 2011 5:25 pm

praaab wrote:ok i have a few questions on my game that im creating. 1. how do i make my game online, like to make other people play against eachother. 2. how do i make my character shoot from the side hes facing because he only shoots on the right side. 3. how do i create an ai with gravity and shoot.

1: You can't.
2: Use variables, that's all I know
3: Dunno
Join us on Discord!
Game Editor 2
These are the best ways to reach me these days


Your local Community Janitor, always lurking in the shadows...
User avatar
MrJolteon
 
Posts: 2326
Joined: Sat Aug 09, 2008 3:25 pm
Location: Stranded under endless sky
Score: 105 Give a positive score

Re: online game

Postby Camper1995 » Sat Jun 25, 2011 7:12 pm

3. Dunno
:lol:

But seriously, i don't think we can make online games for now.
New GE should be able to make them.
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: online game

Postby praaab » Sun Jun 26, 2011 6:05 pm

but how do i make the actor able to shoot from both sides
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score

Re: online game

Postby lcl » Sun Jun 26, 2011 6:25 pm

praaab wrote:but how do i make the actor able to shoot from both sides

First, you need to declare a variable. Go to some event with script editor and at the script editor click variables, then add, then name it dir (shortening for direction), leave those integer and global as they are and click add. Then close the script editor.

Now add this code to your player actors key down event (right) - script editor:
Code: Select all
dir = 1;

And this for key left:
Code: Select all
dir = 0;

Now, 1 is for right and 0 is for left.

Next, go to the key down event for shooting - script editor and add this code:
Code: Select all
CreateActor(...); //You can add the function to script by clicking "variables/functions". Find CreateActor(); from there and create your bullet actor.
if (dir == 1)
{
    bullet.xvelocity = 10;
}
else if (dir == 0)
{
    bullet.xvelocity = - 10;
}

Remember to change the "bullet" before those xvelocities to the name of your bullet actor.
There you go! Did this help? :)

- lcl -
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: online game

Postby praaab » Sun Jun 26, 2011 7:00 pm

yes this helped a lot thank you so much but i have one more question. how do i load my game onto my ipod with geplayer?
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score

Re: online game

Postby lcl » Sun Jun 26, 2011 7:06 pm

praaab wrote:yes this helped a lot thank you so much but i have one more question. how do i load my game onto my ipod with geplayer?

Sorry, I don't know about this, I don't have iPod.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: online game

Postby praaab » Sun Jun 26, 2011 7:17 pm

ok one more questioin im trying to create an ai but he doesnt have gravity and i dont know how to add gravity to him?
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score

Re: online game

Postby Hblade » Sun Jun 26, 2011 7:19 pm

Draw Actor:
Code: Select all
yvelocity+=.5;
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: online game

Postby praaab » Sun Jun 26, 2011 7:26 pm

ok i know how to use gravity but the ai code.
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score

Re: online game

Postby lcl » Sun Jun 26, 2011 7:29 pm

Hblade wrote:Draw Actor:
Code: Select all
yvelocity+=.5;

U didn't feel like writing much? :lol:

And as for you praaab that code Hblade provided does increase yvelocity (the actors velocity on y axis) by 0.5 every frame, because it comes to draw actor, and all code in draw actor event is executed every frame when actor is drawn. So with the preset fps of GE (30) (you can change it in game settings) it will add this 0.5 to the actors yvelocity 30 times in second. That makes the actor accelerate while falling.

And yes, for some reason, Ge's y axis numbers are inverted in comparison to normal. So minus is up and plus is down. :)

EDIT: this seems not to be what you're trying to do..
What do you need to do? :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: online game

Postby praaab » Sun Jun 26, 2011 7:33 pm

no listen, i try to use ai like enemy>draw actor>script editor>MoveTo>player>avoid none. he follows you but doesnt fall to the ground
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score

Re: online game

Postby lcl » Sun Jun 26, 2011 7:51 pm

Ahh, now I see!
Take that MoveTo -command away, here is the solution:
Code: Select all
int move = - 1 + 2 * (x < player.x);
x += 5 * move;

What this code does it creates local variable move and sets it to - 1 and then adds 2 to it if x < player.x. those brackets return 0 or 1 depending on if the condition inside them is true or not. If it is true move will be 1, otherwise it'll be - 1.
And now the actor will move 5 pixels to right or left according to what is the value of move. :D

Did you understand my explanation? :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: online game

Postby praaab » Mon Jun 27, 2011 12:36 am

ok well 3 more things, 1 i dont know how to make him change his animation(enemy) when he moves left and right. 2 how do i make him jump when the player is above him? 3. how do i make the ai shoot from both sides by himself like the player and yes this was very helpful thankyou
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score

Re: online game

Postby skydereign » Mon Jun 27, 2011 5:58 am

Well if your animations are in a certain order you can do this.
Code: Select all
int move = - 1 + 2 * (x < player.x);
x += 5 * move;

ChangeAnimation("Event Actor", getAnimName(x<player.x + 2), NO_CHANGE);

By certain order I assume you are using this.
Stand Right
Stand Left
Move Right
Move Left
anything else

If not you'll have to use this.
Code: Select all
int move = - 1 + 2 * (x < player.x);
x += 5 * move;

switch(move)
{
    case -1:
    ChangeAnimation("Event Actor", "move_left", NO_CHANGE);
    break;

    case 1:
    ChangeAnimation("Event Actor", "move_right", NO_CHANGE);
    break;
}


To make it jump the easiest way would be to have it jump whenever it can (otherwise you'd have to get into predicting platforms). So add this to the end of the above code.
Code: Select all
if(jump==1)
{
    yvelocity=-10;
    jump=0;
}


Add a collision event with the ground to reset jump to 1 (jump needs to be an actor variable). If you have jump animations and don't have the animations in the order suggested above, then copy it into the if statement and switch the names to jump_right and jump_left (if you do you can use the same ChangeAnimation code but instead of +2 add +4).


Lastly if you want the enemy to shoot the direction its facing you can do this (I assume you already have code to make it shoot, so having a CreateActor call). Change 15 to the speed you want.
Code: Select all
CreateActor("bullet", "bullet_anim", "(none)", "(none)", 0, 0, false)->xvelocity=((x<player.x)-(x>player.x))*15;
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Next

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest