Tutorial : Let's get Some arms!

Learn how to make certain types of games and use gameEditor.

Tutorial : Let's get Some arms!

Postby ingsan » Thu Feb 19, 2004 11:18 am

What we are going to do is to make our
MainCharacter :

1-pick "different" arms that he will be able to
use following certain conditions.

2-enable him to "choose" whatever arm (depending
on what he has picked up)he wants to use,
whenever he has picked more than one arm.

What we have to note down first is that there
would be one key to activate/choose the arm (let's
say "s") and another to use this arm(say "c").
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

part one

Postby ingsan » Fri Feb 20, 2004 11:11 am

>>> LET'S BEGIN!

add an actor ("background")
and add an animation ("Background2.png").

Download : Background2

Image

add an actor ("MainCharacter")
and add an animation ("Main.png").

Download : MainCharacter

Image

>add Event Key-down ("Right-arrow key") with repeat
enabled. add Action ("Script Editor") and write :


x=x+3;


>Add as immediate action.

>add Event Key-Down ("Left-arrow key") with repeat
enabled. add Action ("Script Editor") and write :


x=x-3;

>Add as immediate action.


N.B i also placed two Region actors ("StopL" and
"StopR") on the left and right side of the view which
stops, on collision, my main character, but it is
optional...

Now, on "MainCharacter" :

add Event ("Create Actor")
add Action ("Script Editor") and write :


currentarm=1;
red=0;
blue=0;


// "currentarm", "red" and "blue" being an integer
and global variable that you have to create.
Last edited by ingsan on Fri Feb 20, 2004 11:15 am, edited 1 time in total.
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

part two

Postby ingsan » Fri Feb 20, 2004 11:13 am

>>> We will now create TWO arm-actors, gun1
(RED gun) and gun2(BLUE gun).

Download : Gun1 & Gun2

Image
Image
Now, on "MainCharacter" :

add Event ("Collision") with "gun1"
add Action ("Script Editor") and write :


red=1;


and add Event (" Collision") with "gun1"
add Action ("Destroy Actor") "gun1" as immediate action.


Do the same when "MainCharacter" collides with
"gun2" but instead of writing "red=0;", write :

blue=1;

And there also, on collision with "MainCharacter",
destroy Actor "gun2".


Then on "MainCharacter" add Event Key Down "s" with
repeat disabled,
add Action ("Script Editor") ans write :


currentarm++;
if(currentarm>3) currentarm=1;


>>>This will enable you to "swap" a dialogue to
choose what arm you want to select (RED or BLUE)
and if picked before, i.e if red=1 and/or blue=1, use
them.
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby hobgoblin » Sat Feb 21, 2004 5:17 pm

this is so hard... :(
hobgoblin
 
Posts: 97
Joined: Sat Feb 21, 2004 5:10 pm
Location: BEHIND YOU!!!
Score: 0 Give a positive score

Postby ingsan » Sat Feb 21, 2004 9:09 pm

What do u find hard. i can explain. :wink:
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby hobgoblin » Sat Feb 21, 2004 10:49 pm

well, i got this program yesterday

everything looks hard
:D
hobgoblin
 
Posts: 97
Joined: Sat Feb 21, 2004 5:10 pm
Location: BEHIND YOU!!!
Score: 0 Give a positive score

Postby ingsan » Mon Mar 08, 2004 12:34 pm

>>>Now we are going to create a Dialogue Actor
that would appear on screen when "s" is pressed.
This function wil enable us to "choose" out of the
two guns picked.

add Actor "Dialogue"
add Animation "dialogue.png"

Image

>>>This is a transparent image that will appear
when u press "s" button. It is within this dialogue that
u would be able to actually choose ur arm
(red or blue).

>Add Event ("Draw Actor") on "dialogue"
add Action ("Script Editor") and write :



Code: Select all
if(currentarm>1) VisibilityState("Event Actor", true);
else VisibilityState("Event Actor", false);




>Add as immediate action.

>>>Now anytime u press on "s", the dialogue
appears,and it disappears after 3 key press.

What i want the player to do is that whenever he
picks an arm, he must actually "select" it by pressing
"s" and then he can use it by pressing "c".

To make things simple, we will create little icons
that would show us whenever an arm has been
picked.

add Actor "red_icon"
add animation "red icon.png"

Image

add Actor "blue_icon"
add animation "blue icon.png"

Image

Select "red_icon" :
>Add Event ("Draw Actor") and add Action ("Script Editor")
and write :



i
Code: Select all
f(currentarm==2 && red==1)
{
  VisibilityState("EventActor",true);
}
else
{
  VisibilityState("EventActor",false);
}





>Add as immediate action.

Select "blue_icon" :

>Add Event("Draw Actor") and add Action ("Script Editor")
and write :



Code: Select all
if(currentarm==3 && blue==1)
{
  VisibilityState("Event Actor", true);
}
else
{
  VisibilityState("EvenetActor",false);
}




Add as immediate Action.

>>> Now u can test the game. Pick an arm(red or
blue) and press "s". The result is that if u have
selected the red gun, the "red_icon" appears and if
u have selected the blue gun, the "blue_icon"
appears.
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby jazz_e_bob » Wed Mar 17, 2004 4:53 pm

Cool. 8) All working at this end. You have taught me many new things. :)

Thankyou ingsan.

BTW

N.B i also placed two Region actors ("StopL" and
"StopR") on the left and right side of the view which
stops, on collision, my main character, but it is
optional...


How did you use these region actors?

How does the dialogue png file have transparency built in!? Can I do this in photoshop?
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby ingsan » Wed Mar 17, 2004 6:50 pm

Thanx :oops:

Well the Region actors ie StopL and StopR are only there if u don't want your MainCharacter to go out of screen, or a region of your choice (very useful for platform games). On Collision, go to Anterior Position.

For the transparent bitmap, yes you can do it on Photoshop. Well i actually did it on Flash but it follows the same rules:
    Just remember that if you want a bitmap with an alpha (or transparency), you have to put a layer first on which you have nothing ie no white or black or pink background ! :) and on another layer, you put your image and then define its opacity.

mmm.... are we in GE's forum ... :? mmm that famous forum where genious talk about making the coolest games of all and not about some photoshop thing ....mmmm.... :? difficult to tell ...

hi hi hi :mrgreen: says mr Green ! :lol:
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby jazz_e_bob » Wed Mar 17, 2004 10:42 pm

argh! :cry: Can't get this to work!

On MainCharacter actor:

Actor control
Add Event "Collision"
Add Action "To Anterior Position"

He still goes through where the green boxes are...
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby ingsan » Wed Mar 17, 2004 10:49 pm

:? mmm...on Collision Event have you enabled "Continue this on collision = Yes" ?

Not telling GE that the collision Event and Action should continue everytime an Actor collides with another Actor will not make it work.
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby ingsan » Wed Mar 17, 2004 10:57 pm

:mrgreen:
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby jazz_e_bob » Wed Mar 17, 2004 11:52 pm

bingo! thanks ingsan. :)
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby ingsan » Thu Mar 18, 2004 10:09 am

Cheers :mrgreen:

Image
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Re:

Postby equinox » Mon Feb 04, 2008 12:06 am

add Actor "red_icon"
add animation "red icon.png"

Select "red_icon" :
>Add Event ("Draw Actor") and add Action ("Script Editor")
and write :

i
Code: Select all
f(currentarm==2 && red==1)
{
  VisibilityState("EventActor",true);
}
else
{
  VisibilityState("EventActor",false);
}



I use this code, but the red icon is always visible....

but if i use this code---> VisibilityState("redicon",DONT_DRAW_ONLY);,,the red icon Disappears,,

Why?

Tnk1000 for reply.
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Next

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest