lunar lander game

Moderators: Valkyrion4, Wallaz, OutofLine, goodie633, RandomProductions

lunar lander game

Postby DavidS » Tue Jan 05, 2010 2:17 am

Hi all. I'm fairly new to this board and new to flash programming. I have searched and can't seem to find what I'm looking for, but possibly a way around it.

I'm wanting a scoreboard I can update dynamically, but I'm reading that LiveSwif doesn't do dynamic text. I guess I could put up a meter for fuel and speed, but how do I do a score at the end of the level?

I'm working on a lunar lander game, you can look at the lmv at http://www.mediafire.com/pcsfiles. It's called lander.lmv

Anyway, hello everyone and happy new year. I look forward to talking you all of you and writing swf and having fun. :)

**ATF: I've been working on it and got some bugs out, plus fixed the fuel bar. The lmv is at the site listed above and the swf is embedded at http://pcsadmin.webs.com/programmingpage.htm

David
"It smoked, it drank, it kept cutting corners. It was a degenerate triangle."
User avatar
DavidS
L
 
Posts: 13
Joined: Sun Jan 03, 2010 4:55 am

Re: lunar lander game

Postby DavidS » Wed Jan 06, 2010 3:52 pm

Well, I beat my head against a wall for quite awhile to get the code working, but it's finally working.

Thanks to RandomProductions for the tutorial, for some reason it didn't come up when I did a search here.

so, fo, po are all ones digits for different scores. The solution was that I had originally put score and fuel as variables attached to a movie clip names Looney and so the code didn't see the variables. Changing everything to _root.var worked like a charm.

Code: Select all
_root.so.nextFrame();
if (_root.so._currentframe == 11) {
    _root.so.gotoAndStop(1);
   s.start();
    _root.st.nextFrame();
}
if (_root.st._currentframe == 11) {
    _root.st.gotoAndStop(1);
    _root.sh.nextFrame();
}
if (_root.sh._currentframe == 11) {
    _root.sh.gotoAndStop(1);
    _root.sm.nextFrame();
}


Anyway, I'm about ready to start on level two. I have one bug I can't seem to figure out, when you press the up arrow the thrust appears and then for some reason goes to left thrust and I can't figure why. Anyone want to look at it read the previous post. :)

David
"It smoked, it drank, it kept cutting corners. It was a degenerate triangle."
User avatar
DavidS
L
 
Posts: 13
Joined: Sun Jan 03, 2010 4:55 am

Re: lunar lander game

Postby N.2 » Fri Jan 08, 2010 7:37 pm

heya, I found your problem

The reason that bug exist is because your useing gotoandplay

use this code on your keyDown event (in the looney sprite instance)

Code: Select all
if (Key.isDown(Key.UP)) {
   if (fuel>0){
   fuel-=0.3;
   _root.fbar._yscale=(fuel*0.25);
   _root.fbar._Y=120-(fuel*0.8);
   vspeed-=vacc;
   _root.Looney.gotoAndStop(2);
}}
if (Key.isDown(Key.LEFT)){
   if (fuel>0){
   fuel-=0.1;
   _root.fbar._yscale=(fuel*0.25);
   _root.fbar._Y=120-(fuel*0.8);
   hspeed-=hacc;
   this.gotoAndStop(4);
}}
if (Key.isDown(Key.RIGHT)){
   if (fuel>0){
   fuel-=0.1;
   _root.fbar._yscale=(fuel*0.25);
   _root.fbar._Y=120-(fuel*0.8);
   hspeed+=hacc;
   this.gotoAndStop(3);
}}
User avatar
N.2
LIVESW
 
Posts: 117
Joined: Mon Jul 27, 2009 7:00 pm

Re: lunar lander game

Postby DavidS » Sat Jan 09, 2010 6:22 am

heya, I found your problem

The reason that bug exist is because your useing gotoandplay

use this code on your keyDown event (in the looney sprite instance)


Hey, that worked like a charm! Thanks, N.2!

So that shows you how new I am to this stuff. :oops: I have stop(); on each frame of my Looney sprite so I thought the gotoAndPlay(#) would work just as well as gotoAndStop(#)

David

P.S Does anyone get the Looney ref? "Get your looney shuttle tickets"
"It smoked, it drank, it kept cutting corners. It was a degenerate triangle."
User avatar
DavidS
L
 
Posts: 13
Joined: Sun Jan 03, 2010 4:55 am


Return to Showcase (Liveswif)

Who is online

Users browsing this forum: No registered users and 1 guest