Page 1 of 2

Tutorial : Let's get Some arms!

PostPosted: Thu Feb 19, 2004 11:18 am
by ingsan
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").

part one

PostPosted: Fri Feb 20, 2004 11:11 am
by ingsan
>>> 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.

part two

PostPosted: Fri Feb 20, 2004 11:13 am
by ingsan
>>> 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.

PostPosted: Sat Feb 21, 2004 5:17 pm
by hobgoblin
this is so hard... :(

PostPosted: Sat Feb 21, 2004 9:09 pm
by ingsan
What do u find hard. i can explain. :wink:

PostPosted: Sat Feb 21, 2004 10:49 pm
by hobgoblin
well, i got this program yesterday

everything looks hard
:D

PostPosted: Mon Mar 08, 2004 12:34 pm
by ingsan
>>>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.

PostPosted: Wed Mar 17, 2004 4:53 pm
by jazz_e_bob
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?

PostPosted: Wed Mar 17, 2004 6:50 pm
by ingsan
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:

PostPosted: Wed Mar 17, 2004 10:42 pm
by jazz_e_bob
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...

PostPosted: Wed Mar 17, 2004 10:49 pm
by ingsan
:? 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.

PostPosted: Wed Mar 17, 2004 10:57 pm
by ingsan
:mrgreen:

PostPosted: Wed Mar 17, 2004 11:52 pm
by jazz_e_bob
bingo! thanks ingsan. :)

PostPosted: Thu Mar 18, 2004 10:09 am
by ingsan
Cheers :mrgreen:

Image

Re:

PostPosted: Mon Feb 04, 2008 12:06 am
by equinox
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.