Script Editor

Game Editor comments and discussion.

Script Editor

Postby Jose » Sat Apr 05, 2008 11:57 pm

Ok, :?, this may sound dumb, but i'm new, how does script editor works.
all i see are x´s and y´s and numbers. I dont understand it at all. i look for the tutorial in the program Game-editor and i don't find it. i have seen some tutorials about it, but i still have some difficulties like collisions, physical respond, create and destroy actors. Can some one explain me what the x´s and y´s mean. why are the numbers included and what they mean too.those parenthesis and semicolons too.i have a serious problem with this. How do you konw where t put this and that and why.
Hope you understand me.
Jose
 
Posts: 7
Joined: Fri Apr 04, 2008 4:56 pm
Score: 0 Give a positive score

Re: Script Editor

Postby Freddy » Sun Apr 06, 2008 12:58 am

Well, for the x's and y's. Im sure youve heard of the x axis and the y axis. This is what the letters stand for. The numbers next to them can mean a bunch of different things, from the position on the screen, to the speed of an actor.
I'll explain this simple script, and hopefully youll have a better understanding :D
Code: Select all
x = x + 5;

The x stands for the x axis (as we have already established), and the 5 is the speed at which the actor is moving on the posotive side (to the right) of the x axis. In this particular code, its 5 pixels per frame.
So, if x = x + 5; makes an actor go right at 5 pixels per frame, then:
Code: Select all
x = x - 5;

must make the actor move to the left at 5 pixels per frame.
This is the same with the y axis:
Code: Select all
y = y + 5;

makes the actor move down at 5 pixels per second, and vice versa.

As for the semicolons, in C++, (which is the computer language that Game Editor works on), at the end of every command, a semicolon is placed. Its sort of like... a period, if you will. Just like at the end of every sentence you add a period, at the end of every command, you add a semicolon.

Well I hope that helped you a little bit, but in the meantime, what do you need help with in collisions and physical response?
:)
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score

Re: Script Editor

Postby Jose » Mon Apr 07, 2008 12:07 am

thanxs, now i need help doing my character jump, gravity, making him die by falling or by having contact with an enemy, and doing different levels,like level 1, level 2 and so on.
And with collisions and physical response, how they work and what is their function.

Sorry if i ask too much, but i´m just starting. :lol:
Jose
 
Posts: 7
Joined: Fri Apr 04, 2008 4:56 pm
Score: 0 Give a positive score

Re: Script Editor

Postby Freddy » Mon Apr 07, 2008 8:09 pm

To make your character jump, this is what ya do. :)
1. Add a keydown event -> spacebar (make sure the button that says "enabled" is set to "disabled" -> script editor.
2. Type in:
Code: Select all
 yvelocity = yvelocity - 10;

3. Once you have done this, add a draw actor event -> script editor.
4. Type in:
Code: Select all
yvelocity = yvelocity + .8;

5. If you dont already have a ground actor, make one.
6. If your actor doesnt already have a collision -> physical response to the ground, make one.
7. Thats all!
:)
Hope this has helped you.
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score

Re: Script Editor

Postby Freddy » Mon Apr 07, 2008 8:12 pm

To make your character die when it comes in contact with an enemy, it's pretty simple. If you want to make health for your character, it's a little more complex, but I'm sure you can do it. So to save time, I'm just going to show you how to make it die if it hits the enemy once. :)
1. Add a collision event (any side of the enemy) -> destroy actor (event actor)
Thats all :D
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score

Re: Script Editor

Postby Freddy » Mon Apr 07, 2008 8:19 pm

For making different levels, it's hard to say. I would need to know what type of game you're making.

What exactly do you mean by, what are the functions of physical response?
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score

Re: Script Editor

Postby Jose » Mon Apr 07, 2008 11:51 pm

my game is a platform game, Mario style. To the different levels i refer to, level 1, after completing it level 2 and so on.
Is there a way to make the character die if he falls out just like in Mario? And make him start again the level?
For physical response, what i mean is, when is it useful, where is it suppose to be used, like an example.
Jose
 
Posts: 7
Joined: Fri Apr 04, 2008 4:56 pm
Score: 0 Give a positive score

Re: Script Editor

Postby Freddy » Tue Apr 08, 2008 12:05 am

Well, to make mario die when he falls, you could make an actor, and instead of making it a normal actor, make it a wire frame region actor for eache level. Stretch them across the whole bottom sections. Then go to your mario character, and add a collision event, anyside of level1wireframeregion -> script editor:
mario.y = the posistion of the y axis where mario begins on the first level
mario.x = put the x posistion of Mario here when he begins.

Do the same thing for the other wire-frame-region actors for levels 2, 3, 4, etc.

To make Mario go to different levels, you should make an actor (it could be a wire-frame-region if you want) at the end of the levels. Then make a collision event with mario -> script editor:
mario.y = (put whatever the y position for the 2nd level is here)
mario.x = (put whatever the x position for the 2nd level is here)

As for collisions and physical response, these are good for stopping actors from falling through grounds, and other barriers. They are good for making things bounce. Umm, I cant think of any other uses for them at the moment, but I'm sure there are a few more.
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score

Re: Script Editor

Postby thunderios » Tue Apr 08, 2008 3:15 pm

When you fall down too hard and die you should make an event:

Collision (top side of Ground)-> Script editor: if(yvelocity > (some number like 5)) DestroyActor;
if(yvelocity < 5)PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS "1" "1" "0" "1");

The of course you gravity shouldn't be "y = y + .2" but "yvelocity += .2"
thunderios
 
Posts: 87
Joined: Thu Jan 31, 2008 1:18 pm
Score: 1 Give a positive score

Re: Script Editor

Postby Freddy » Tue Apr 08, 2008 8:09 pm

thunderios wrote:
The of course you gravity shouldn't be "y = y + .2" but "yvelocity += .2"

Acutally, the method I mentioned would work better, because, just like in reality, the gravity in the game would pull mario faster and faster the longer he dropped. The method you mentioned would let him fall at a fixed rate. :wink:
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score

Re: Script Editor

Postby Jose » Tue Apr 08, 2008 11:13 pm

Hey, i think i'm starting to get this.
Now, how do i make Mario lose lives to make a Game Over appear? And how to restart after it?
And, will it be easy for me to make a score?
Jose
 
Posts: 7
Joined: Fri Apr 04, 2008 4:56 pm
Score: 0 Give a positive score

Re: Script Editor

Postby Freddy » Tue Apr 08, 2008 11:27 pm

Jose wrote:Hey, i think i'm starting to get this.

Great!
Allright, to make a gameover appear when Mario dies, umm, does this mean when he loses all of his lives? Or do you mean when he dies once?

Making a score for your game will be a very easy step:
1. When Mario does something that earns points, like collecting coins and such, add a collision event (any side of coin) -> script editor:
Code: Select all
score = score + 1;

You will need to make a variable called score. To do this, click on the button that says something like "variables" at the bottom of the script editor menu. There are two buttons that contain this word, make sure you choose the one on the right. A menu should appear. Type in "score" and click on the "add" button.
Then, add an actor for the score. Make this actor a text actor, by clicking the "text" button on the upper right-hand corner of the menu. Type 0, choose a font, and click OK, or whatever it says.
Add a draw actor event -> script editor:
Code: Select all
textNumber = score

That should be all. :)
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score

Re: Script Editor

Postby Jose » Thu Apr 10, 2008 10:40 pm

OK, for the game over i refer to losing all of his lives. And can i do a starting screen, the one that says start, options and all that? You´ve been very useful. Thanks
Jose
 
Posts: 7
Joined: Fri Apr 04, 2008 4:56 pm
Score: 0 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron