Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

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


Forum Topic: help with working with variables

(96 views • 9 replies)

This topic is 1 page long.

<< < > >>
Happy

iluvAS

Reply To Post Reply & Quote

Posted at: 4/22/08 08:21 AM

iluvAS NEUTRAL LEVEL 06

Sign-Up: 11/18/07

Posts: 123

im having some problems to work with variables can some1 help me??

im making a spaceship shooter kinda thing like the game garuda evolution...
im trying to make it like a lvl up kinda thing. ive done the lvl1,2,3 of the thrusters,wings and armor.
in the main mc instance named: bk, i put in:

onClipEvent(load){
wings=1;
thrusters=1;
body=1;
speed=3.5;
handling=5;
health=100;
}
onClipEvent(enterFrame){
if(Key.isDown(Key.UP)){
_root.bk._y-=speed*thrusters
}
if(Key.isDown(Key.DOWN)){
_root.bk._y+=speed*thrusters
}
if(Key.isDown(Key.RIGHT)){
_root.bk._x+=handling*wings
}
if(Key.isDown(Key.LEFT)){
_root.bk._x-=handling*wings
}
}

and to test it out i made a button with the actionscript in it:

on (release) {
wings+10
}

but i get no difference in the speed of moving _x wise.... can some1 teach me how to properly use the change variable thingy and if possible can some1 pro add me in msn to help me XD im not tat noob so i doubt ull get frustrated teaching me. PLS HELPP


None

Neo-13

Reply To Post Reply & Quote

Posted at: 4/22/08 08:28 AM

Neo-13 LIGHT LEVEL 18

Sign-Up: 06/09/07

Posts: 719

At 4/22/08 08:21 AM, iluvAS wrote: and to test it out i made a button with the actionscript in it:

on (release) {
wings+10
}

but i get no difference in the speed of moving _x wise.... can some1 teach me how to properly use the change variable thingy and if possible can some1 pro add me in msn to help me XD im not tat noob so i doubt ull get frustrated teaching me. PLS HELPP

You need to do wings += 10, not just + 10.

Like this:

on (release) {
     wings+10
}
BBS Signature

None

Neo-13

Reply To Post Reply & Quote

Posted at: 4/22/08 08:30 AM

Neo-13 LIGHT LEVEL 18

Sign-Up: 06/09/07

Posts: 719

Whoops, forgot the ";". Please excuse the double post.

wings += 10;
BBS Signature

None

iluvAS

Reply To Post Reply & Quote

Posted at: 4/22/08 08:32 AM

iluvAS NEUTRAL LEVEL 06

Sign-Up: 11/18/07

Posts: 123

no difference dood T.T plas help....
if possible can u add me in msn???
ill send u my hotmail through a PM.


Crying

iluvAS

Reply To Post Reply & Quote

Posted at: 4/22/08 08:43 AM

iluvAS NEUTRAL LEVEL 06

Sign-Up: 11/18/07

Posts: 123

PLSPLSPLSPLSPLSPLSPLSPLSPL
HELPPPP MEEEEEEEEEEEEEE
i cant find any godd tutorials on dis in ng.
i swear if i can nail dis aspect of as ill help all those aspiring scripters with a reallly nice working tutorial
i want to learn not just to make games so pleaaase
HELPPP MEEEE T.T


None

twistedduck

Reply To Post Reply & Quote

Posted at: 4/22/08 08:56 AM

twistedduck NEUTRAL LEVEL 07

Sign-Up: 10/23/06

Posts: 53

Is this code inside bk? If so, try this:

onClipEvent(load){
wings=1;
thrusters=1;
body=1;
speed=3.5;
handling=5;
health=100;
}
onClipEvent(enterFrame){
if(Key.isDown(Key.UP)){
_y-=speed*thrusters
}
if(Key.isDown(Key.DOWN)){
_y+=speed*thrusters
}
if(Key.isDown(Key.RIGHT)){
_x+=handling*wings
}
if(Key.isDown(Key.LEFT)){
_x-=handling*wings
}
}

If that works, then movieclip isnt called bk, or it isnt in _root.

BBS Signature

None

iluvAS

Reply To Post Reply & Quote

Posted at: 4/22/08 09:07 AM

iluvAS NEUTRAL LEVEL 06

Sign-Up: 11/18/07

Posts: 123

well dat part totally works well.
the problem is that im trying to increase the speed of moving through _x
by increasing the handling of bk.
in order to test that i made a button that has the AS:
on (release){
handling +=10;
}
annnnnd it didnt work.........


None

twistedduck

Reply To Post Reply & Quote

Posted at: 4/22/08 09:38 AM

twistedduck NEUTRAL LEVEL 07

Sign-Up: 10/23/06

Posts: 53

how about

on (release) {
_root.bk.handling += 10;
}

I think you'll find that works.

BBS Signature

None

iluvAS

Reply To Post Reply & Quote

Posted at: 4/23/08 02:40 AM

iluvAS NEUTRAL LEVEL 06

Sign-Up: 11/18/07

Posts: 123

HOLY SHIEEET IT WORKS TQTQTQTQTQT SO MUCH U R MY HEROOOOOOO :D


None

MTCronky

Reply To Post Reply & Quote

Posted at: 4/23/08 03:12 AM

MTCronky NEUTRAL LEVEL 07

Sign-Up: 07/10/07

Posts: 52

At 4/23/08 02:40 AM, iluvAS wrote: HOLY SHIEEET IT WORKS TQTQTQTQTQT SO MUCH U R MY HEROOOOOOO :D

WHO am I to accept such a great Honor? I'll tell you who I am, I'm that random passerby you didn't see. I'm the hobo you said you didn't have change too, but then felt your pocket full of coins from just coming from the nickel arcade. I am the old woman you DIDN'T help across the street so traffic had to wait the extra 20 minutes for her to figure out her walker was stuck on a peddle in the road.

Yes, I am that Man, and I believe in a better tomorrow.

Vote Cronky for President


All times are Eastern Daylight Time (GMT -4) | Current Time: 02:59 PM

<< 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!