Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: need room escape coding///

(236 views • 23 replies)

This topic is 1 page long.

<< < > >>
Questioning

FatKidWitAJetPak

Reply To Post Reply & Quote

Posted at: 6/13/08 12:29 AM

FatKidWitAJetPak LIGHT LEVEL 16

Sign-Up: 07/28/07

Posts: 1,459

Ok, so I am aking a room escape game. I have all my variales and everything. I just need to know some coding for how to make my items in my inventory interact with items in the game, and how to make them GOTTEN from the game. I also need to know how to maker them invisible in my inventory.

THanks a lot.

need room escape coding///


None

FatKidWitAJetPak

Reply To Post Reply & Quote

Posted at: 6/13/08 12:32 AM

FatKidWitAJetPak LIGHT LEVEL 16

Sign-Up: 07/28/07

Posts: 1,459

First of all, i need some simple coding for how to make the red diamond in that inventory turn invisible, then be gotten from the ravens red eye.


None

Afro-Ninja

Reply To Post Reply & Quote

Posted at: 6/13/08 12:33 AM

Afro-Ninja EVIL LEVEL 35

Sign-Up: 03/02/02

Posts: 13,084

like I said man, it's all about using the boolean variables to represent various states of true and false

give it a try and see what you come up with :)

BBS Signature

None

FatKidWitAJetPak

Reply To Post Reply & Quote

Posted at: 6/13/08 12:36 AM

FatKidWitAJetPak LIGHT LEVEL 16

Sign-Up: 07/28/07

Posts: 1,459

I hav e been man.. thats why i need some help.

I have these movie clips.

gdiamond_mc
gdiamond1_mc

pliers_mc
pliers1_mc

hammer_mc
hammer1_mc

wire_mc
wire1_mc

and son on. So how do i make them Variables? (code plz)


None

The-Swain

Reply To Post Reply & Quote

Posted at: 6/13/08 12:56 AM

The-Swain LIGHT LEVEL 07

Sign-Up: 09/16/05

Posts: 332

Strangely enough, you don't actually "make" movie clips into variables.

BBS Signature

None

Kart-Man

Reply To Post Reply & Quote

Posted at: 6/13/08 12:56 AM

Kart-Man NEUTRAL LEVEL 22

Sign-Up: 01/07/07

Posts: 3,054

At 6/13/08 12:36 AM, FatKidWitAJetPak wrote: and son on. So how do i make them Variables? (code plz)

I'm not quite sure if you know what a variable is. Let's start with that first.

AS: Variables

In escape games, you use a many number of Booleans to check whether you have "gotten" an item or not, so that it can advance the game forward. First you declare the variable:

 var llamaGet:B oolean = false; 

Then, when you acquire something by clicking on it in-game, you change the boolean to 'true' on the click event.

On an enterFrame handler, you need to continuously loop for the variable to see if it is true in order to trigger an event. This is what it would look like inside the handler:

if (llamaGet  == true){
cutScene();
}

Further reading:
Adobe Actionscript Dictionary - Booleans

postcount +=1;
Diner Cafe || LED lights!
Tom and the Afro-Ninja Sigs -- check it, foo'.

BBS Signature

None

FatKidWitAJetPak

Reply To Post Reply & Quote

Posted at: 6/13/08 01:34 PM

FatKidWitAJetPak LIGHT LEVEL 16

Sign-Up: 07/28/07

Posts: 1,459

Roght, and do you name the movieclip before the "Get" like hammerGet or gdiamond Get


None

Gutya

Reply To Post Reply & Quote

Posted at: 6/13/08 01:46 PM

Gutya FAB LEVEL 07

Sign-Up: 11/27/06

Posts: 777

No, he just named the Boolean variable 'llamaGet' you could call it 'poop', 'wank' or 'hello'. It's all the same, the names don't matter.


Expressionless

FatKidWitAJetPak

Reply To Post Reply & Quote

Posted at: 6/13/08 03:31 PM

FatKidWitAJetPak LIGHT LEVEL 16

Sign-Up: 07/28/07

Posts: 1,459

I mean i need ghelp understandiong what all that is... T _ T


None

Deathcon7

Reply To Post Reply & Quote

Posted at: 6/13/08 05:24 PM

Deathcon7 LIGHT LEVEL 20

Sign-Up: 10/01/03

Posts: 5,140

Read a tutorial buddy. Did you really expect everyone else to hold your hand?


Questioning

FatKidWitAJetPak

Reply To Post Reply & Quote

Posted at: 6/13/08 10:48 PM

FatKidWitAJetPak LIGHT LEVEL 16

Sign-Up: 07/28/07

Posts: 1,459

At 6/13/08 05:24 PM, Deathcon7 wrote: Read a tutorial buddy. Did you really expect everyone else to hold your hand?

WOW. I have read 3 tutorials "buddy". I followed their directions but the coding never worked out for me. So I go to emailing Afro-ninja about the coding. He says bring the question here. So I did. Jesus are you just saying that for a +1 post?


Happy

DawnOfDusk

Reply To Post Reply & Quote

Posted at: 6/13/08 10:54 PM

DawnOfDusk EVIL LEVEL 10

Sign-Up: 02/22/08

Posts: 955

At 6/13/08 05:24 PM, Deathcon7 wrote: Read a tutorial buddy. Did you really expect everyone else to hold your hand?

Well really FKWAJP (yes lol) Although the text makes him seem like he was acting pretty rude, it has some knowledge to it.

In fact, unstead of reading a tutorial, why not just buy a book?
This way you can understand this all alot faster and you won't have to get made at people, which is always a good thing =)


None

ElDebugger

Reply To Post Reply & Quote

Posted at: 6/13/08 11:02 PM

ElDebugger NEUTRAL LEVEL 01

Sign-Up: 04/11/08

Posts: 160

to make movieclips(MC) invisible, you have to turn off their visibility. This is done by setting their "_visible" property to FALSE.

For example, you have a hammer_MC movieclip. If you write:

hammer_MC._visible = false;

...you won't see the hammer MC anymore. It will be invisible. Set the property to TRUE to see it again.
Be careful not to do something silly like use "_invisible" instead of "_visible".

Got a broken PSP? Click here and have it fixed for cheap!

BBS Signature

None

FatKidWitAJetPak

Reply To Post Reply & Quote

Posted at: 6/14/08 12:55 PM

FatKidWitAJetPak LIGHT LEVEL 16

Sign-Up: 07/28/07

Posts: 1,459

Alright!! Those last two posts really helped out. I just remembered I had an old actionscripting book from last christmas. I'll pull that out and use the coding the guy above me just gave me.

Oh and I was also wondering, do you put that coding to make the items invisible in the inventory movie clip, or the frame?


None

El-Presidente

Reply To Post Reply & Quote

Posted at: 6/14/08 01:58 PM

El-Presidente LIGHT LEVEL 23

Sign-Up: 06/02/05

Posts: 4,566

At 6/14/08 12:55 PM, FatKidWitAJetPak wrote: Oh and I was also wondering, do you put that coding to make the items invisible in the inventory movie clip, or the frame?

All depends on the code you us. Why not go read that Christmas book, someone spent good money to get it for you :). Seriously though, just look at a few of the Basic AS: Main tutorials and you'll start to understand it. Everyone sucks at scripting when they first start....(except maybe GustTheASGuy, but he's different)

MY E-PENIS IS BIGGER THAN YOURS
8=================================>
AS: Main || AS3: Main || CampNorth || FAB: Warning! Only for real men.

BBS Signature

None

FatKidWitAJetPak

Reply To Post Reply & Quote

Posted at: 6/14/08 07:21 PM

FatKidWitAJetPak LIGHT LEVEL 16

Sign-Up: 07/28/07

Posts: 1,459

At 6/14/08 01:58 PM, El-Presidente wrote:
At 6/14/08 12:55 PM, FatKidWitAJetPak wrote: Oh and I was also wondering, do you put that coding to make the items invisible in the inventory movie clip, or the frame?
All depends on the code you us. Why not go read that Christmas book, someone spent good money to get it for you :). Seriously though, just look at a few of the Basic AS: Main tutorials and you'll start to understand it. Everyone sucks at scripting when they first start....(except maybe GustTheASGuy, but he's different)

Alright, thanks for the link. I did read some of that book by the way, but could not find any useful coding in there lol. °_°


None

iScript

Reply To Post Reply & Quote

Posted at: 6/14/08 07:29 PM

iScript NEUTRAL LEVEL 03

Sign-Up: 06/10/08

Posts: 29

At 6/13/08 12:33 AM, Afro-Ninja wrote: like I said man, it's all about using the boolean variables to represent various states of true and false

give it a try and see what you come up with :)

AHHH BOOLEANS OR NOT MY FIRNEDSSSS.... Booleans so many BOOLEANS, i created one of these games awhile back, i swear i had over 400 booleans or something absurd like that, and keeping track of them all was just nuts...

I think the best way to go around doing this is arrays, and your thinking arrays ZOMFG?!!

Yes arrays, arrays can hold variables...

For instance
var simpleArray:Array = new Array(lol= false);
if(simpleArray[0] ) {
trace("LOL")
}
else{
trace("aww");
}

Then if you wanted to optomize you would create a variable above it and then state what it is...

IE:
var lol:Boolean;
var simpleArray:Array = new Array(lol= false);
if(simpleArray[0] == false) {
trace("LOL")
}
else{
trace("aww");
}
That's the more efficient way to do it.

BBS Signature

None

Treerung

Reply To Post Reply & Quote

Posted at: 6/14/08 07:33 PM

Treerung DARK LEVEL 09

Sign-Up: 04/18/08

Posts: 393

At 6/14/08 07:29 PM, iScript wrote: N00b talk

Seriously, what the hell are you talking about..


None

pieguy48

Reply To Post Reply & Quote

Posted at: 6/14/08 09:41 PM

pieguy48 EVIL LEVEL 05

Sign-Up: 09/03/07

Posts: 94

At 6/14/08 07:29 PM, iScript wrote: all that stuff

I've never used an Array in my life, so this may be a stupid question, but wouldn't it be easier to have Boolean variables? That way, you know what you're talking about. Instead of "simpleArray[0] = false" you have "Key = false".

My advice with a large number of variables is to make them all follow a pattern. For example, using the first three letters and the last letter. A diamond would be "diad", a monkey would be "mony". This has nothing to do with your original question, I know, but hey, whatever ^^


Expressionless

FatKidWitAJetPak

Reply To Post Reply & Quote

Posted at: 6/14/08 10:37 PM

FatKidWitAJetPak LIGHT LEVEL 16

Sign-Up: 07/28/07

Posts: 1,459

°_°

OK. So for all that coding, which is very helpful by the way, Where do I put my item names? (Like screwdriver and hammer.)

I only have 7 inventory items in my game along with about 8 things they do. I have 3 items that combine together. So I would probably have only 20 variables. So I would make everything that you can interact with in the game a Movie Clip? And then create a variable for each one of them?

If the answer is yes, then hurra, I'm starting to get it.


Expressionless

FatKidWitAJetPak

Reply To Post Reply & Quote

Posted at: 6/14/08 10:39 PM

FatKidWitAJetPak LIGHT LEVEL 16

Sign-Up: 07/28/07

Posts: 1,459


None

CaptinChu

Reply To Post Reply & Quote

Posted at: 6/14/08 11:02 PM

CaptinChu DARK LEVEL 15

Sign-Up: 09/11/05

Posts: 3,168

The answer, my friend, is instance names. In the movieclip properties, you can assign an instance name. You can manipulate it with actionscript in the timeline. Lets say I gave that red diamond an instance name of redd:

redd._visible=false

redDiamondArea.onPress=function(){
redd._visible=true
inventory.push(redd)
}

That, of course, if overly simplified. I think that, with this, you should be able to understand enough to do the rest of the game. I wish you the best of luck, and may the pizza be with you.

All programming problems can be solved with Arrays!

BBS Signature

Happy

FatKidWitAJetPak

Reply To Post Reply & Quote

Posted at: 6/14/08 11:47 PM

FatKidWitAJetPak LIGHT LEVEL 16

Sign-Up: 07/28/07

Posts: 1,459

SWEET. so that means that the diamond instance in the game will be visible. Once I press it, the diamond instance in my iventory will be visible right?


None

CaptinChu

Reply To Post Reply & Quote

Posted at: 6/15/08 12:23 AM

CaptinChu DARK LEVEL 15

Sign-Up: 09/11/05

Posts: 3,168

.... Something like that. If you press on an area, you can make the diamond appear in your inventory, like the place where you get the diamond. When you click on and use the diamond, you can adjust the alpha of the movieclip to make it semi-transparent, letting the user know it's been used and the option is now disabled.

All programming problems can be solved with Arrays!

BBS Signature

All times are Eastern Daylight Time (GMT -4) | Current Time: 02:53 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!