Author Topic: Yah Spaced Invaders  (Read 14410 times)

0 Members and 1 Guest are viewing this topic.

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Yah Spaced Invaders
« on: February 22, 2007 »
Ok, I asked Mr. Shockwave if it was ok if I used the theme and stuff from his Spaced Invaders II game to make a clone for YaBASIC, and he accepted.
I have done some of the code: controls, ufo, pick-ups, display, messages... so I guess it is far enough along for a preview.

There are a few things which I would like to ask though (like normal!)
  1: When you pick-up an item from the ufo, the bullets already shot turn into the pick-up bullets?
  2: I need help with coding the invaders!!! I had a go, but they weren't in formation... they kept scrolling wrong... so I got rid of it...

The preview code is attatched.
« Last Edit: February 22, 2007 by CLANKY »
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Online Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Yah Spaced Invaders
« Reply #1 on: February 22, 2007 »
It looks pretty good so far. When you collect a powerup it refreshes the shots bar :) Are you going to code this so that it will run in 50fps on the ps2 or is it going to be an out and out pc version that can contain some of the features of the original?

Good job on the gfx so far by the way :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Yah Spaced Invaders
« Reply #2 on: February 22, 2007 »
Thanx, I'm trying to keep it (within the limitations of the YaBASIC graphics) as close to the original as possible... I even copied the ship from the SI2 file lol...

Yea, most probably PC, runs faster and I only program on the emulator nowdays so I think it wont get to my ps2 lol
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Online Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Yah Spaced Invaders
« Reply #3 on: February 22, 2007 »
Cool. Do you know about the hidden bonuses? You get score bonuses for killing 5 of a kind or 1 of each so the game keeps track of the last 5 things you kill, also there are bonuses for accuracy and speed. There's a lot going on in  this game actually I'll be really interested to see how much you manage to get into the finished version.

Fyi, Spaced invaders was originally a Yabasic game.. It was one of the first things I wrote in Yabasic, I'll see if I can find it.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Yah Spaced Invaders
« Reply #4 on: February 22, 2007 »
Yah, I knew about the sequence bonus, speed and accuracy bonuses... I think they might be medium to code?

Just one question, for the speed bonus - its for the end of the level hey? So I should make a timer, and get your bonus from that?

Yea, I saw your's (nice stuff - abit tricky with the sliding), and another by Fafryer? That was one of the frist codes I copied to my ps2!!! I was really impressed.

Well, I hope I can make the game as close to your as possible... I will try my best!
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Online Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Yah Spaced Invaders
« Reply #5 on: February 22, 2007 »
Here is the original. As you say, the sliding needs a bit of practice :)

Code: [Select]
' OoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO
' oOo Spaced Invaders Coded By Shockwave (C) Dec 2001 oOo
' OoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO
' o                                                     o
' O   A nice little space invaders rip off!!!!!!!!!!!   O
' o  -===============================================-  o
' O              Greetings to everyone at:              O
' o                 WWW.Yabasic.co.uk                   o
' O                 ~~~~~~~~~~~~~~~~~                   O
' OoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO
'=========================================================
'                       Here we go:
'=========================================================
goto setup
label begin
goto titlescreen
label titleout
'=========================================================
'               Set up the pre-game stuff.
'=========================================================
    score=0 : rem Player's score.
    lives=3 : rem Set amount of lives.
    cdt=200 : rem Invulnerable for 4 seconds.
    plx=320 : rem Player X position.
    ply=450 : rem Player Y position.
 shield=440 : rem Shield strength.
       xm=0 : rem Intertia set to 0.
     bspd=5 : rem Enemy shotspeed.
 efiremx=10 : rem how many 50/sec to wait before firing.
     for a=1 to bullets
        pbs(a)=0
     next a
gosub nextlevel
'---------------------------------------------------------
'                      Game Loop :
'---------------------------------------------------------
label game
     coll=coll+1
if coll>2 coll=1

   gosub buffer
   gosub enemy_shots
   gosub bullet
   gosub enemys
   gosub player1
   gosub scores
  if coll=1 gosub ply_en_collision
  if coll=2 gosub enemy_shot_handling
  if enc=24 gosub nextlevel
if lives>0 goto game
'---------------------------------------------------------
'                    End of Game Loop!
'---------------------------------------------------------

repeat
 gosub buffer
 text 320,236,"GAME UNDER","cc"
 text 320,256,"YOU SCORED:"+str$(score),"cc"
 text 320,276,"-=PRESS START TO CONTINUE=-","cc"
until (and(peek("port1"),8)<>0)

'---------------------------------------------------------
'   Go back to top after displaying Game over Message.
'---------------------------------------------------------
goto begin
exit

' OoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO
' oOo The following parts of the program are all cal- oOo
' oOo -led with the GOSUB command.                    oOo
' OoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO

'=========================================================
' This sub routine just draws and moves the enemy shots.
'=========================================================

label enemy_shots
setrgb 1,255,ran(255),ran(255)
for a=1 to enbullets
 if ebs(a)=1 then
  fill rect ebx(a)-2,eby(a)-7 to ebx(a)+2,eby(a)+7
  eby(a)=eby(a)+bspd
  if eby(a)>512 ebs(a)=0
  fi
next a
return

'=========================================================
'Fire enemy bullets and checks for collisions with player.
'=========================================================

label enemy_shot_handling

'=========================================================
'                   Fire new bullet.
'=========================================================

   if enfdelay>0 enfdelay=enfdelay-1
   r=int(ran(24))
   if ens(r)=1 and enfdelay=0 then

      enfdelay=efiremax
       for a=1 to enbullets
       if ebs(a)=0 then
         ebx(a)=enx(r)+15
         eby(a)=eny(r)+10
         ebs(a)=1
         a=enbullets+1
           red=red+20
           grn=grn+20
           blu=blu+20
       fi
       next a
   fi

'=========================================================
'                      Collisions
'=========================================================

if cdt=0 then
  for a=1 to enbullets
  if ebs(a)=1 and eby(a)>ply and ebx(a)>plx-15 and ebx(a)<plx+15 then
     lives=lives-1
     red=red+1000
     grn=grn+1000
     blu=blu+1000
       cdt=200
       plx=320
       shield=440
       ebs(a)=0
   fi
   next a
fi
return

'=========================================================
'       Check For Player bullet/enemy collisions.
'=========================================================

label ply_en_collision
for a=1 to bullets
   if pbs(a)=1 and pby(a)<eny(24)+20 then
   for b=1 to 24
     if ens(b)=1 then
       if pby(a)>eny(b)-5 and pby(a)<eny(b)+30 and pbx(a)>enx(b)-5 and pbx(a)<enx(b)+35 then
       ens(b)=2
       pbs(a)=0
       red=red+100
       grn=grn+100
       blu=blu+100
       score=score+5+int(ran(3))
       edr=edr*1.08
       enof=enof+8
       fi
     fi
   next b
   fi
next a
return

'=========================================================
'              Enemy Drawing And Movements.
'=========================================================

label enemys
  legs=5*sin(mm/2)
  setrgb 1,20,40,20
  for a=1 to 24
  if ens(a)=1 then
    fill triangle enx(a),eny(a) to enx(a)+legs,eny(a)+20 to enx(a)+15,eny(a)
    fill triangle enx(a)+30,eny(a) to enx(a)+30-legs,eny(a)+20 to enx(a)+15,eny(a)
  fi

  if ens(a)>1 then
     setrgb 1,55,55,ens(a)*5
     rect enx(a)+15-ens(a),eny(a)+15-ens(a) to enx(a)+15+ens(a),eny(a)+15+ens(a)
     ens(a)=ens(a)+4

    if ens(a)>30 then ens(a)=0 : enc=enc+1 : fi
    blu=blu+20
    setrgb 1,20,40,20
  fi
  next a

   setrgb 1,55,5,255
   setrgb 2,55,5,255
   setrgb 3,255,255,255

   for a=1 to 24
   if ens(a)=1 then
      gtriangle enx(a),eny(a) to enx(a)+30,eny(a) to enx(a)+15,eny(a)-5
      gtriangle enx(a),eny(a) to enx(a)+30,eny(a) to enx(a)+15,eny(a)+5
   fi
   next a

   revf=0
   for a=1 to 24
     if enof>0 eny(a)=eny(a)+1
     enx(a)=enx(a)+edr
   next a
   for a=1 to 24
     if ens(a)=1 and (enx(a)>610 or enx(a)<0) and revf=0 then revf=1: edr=-edr : a=31 : fi
   next a
   if enof>0 enof=enof-1
return

'=========================================================
'                Draw The Player's Bullets.
'=========================================================

label bullet
setrgb 1,ran(255),ran(255),255
for a=1 to bullets
 if pbs(a)=1 then
     fill rect pbx(a)-3,pby(a)-3 to pbx(a)+3,pby(a)+3
     pby(a)=pby(a)-10
     if pby(a)<0 pbs(a)=0
 fi
next a
return

'=========================================================
'                    Draw Score Table.
'=========================================================

label scores

  setrgb 1,100,155,100
  fill rect 101,26 to 100+shield,35
    setrgb 1,55,255,255
    rectangle 100,5 to 540,25
    rectangle 100,5 to 540,35
       text 101,19,"SCORE :"+str$(score)
       text 451,19,"LIVES :"+str$(lives)
return

'=========================================================
'        Update Player 1 Graphic And Controller.
'=========================================================

label player1

   if firedelay>0 firedelay=firedelay-1
   sv=3+3*sin(mm)
   mm=mm+.6
   setrgb 1,ran(100),ran(155),0
   fill triangle plx-10,ply+20 to plx+10,ply+20 to plx,ply+40+ran(40)

    setrgb 1,255-cdt,100,100
    setrgb 3,255-cdt,200,100
    setrgb 2,0,0,0
      gtriangle plx,ply to plx-20,ply+40 to plx,ply+25
      gtriangle plx,ply to plx+20,ply+40 to plx,ply+25
      setrgb 1,255,255,255
      fill triangle plx,ply+15 to plx+5,ply+25 to plx-5,ply+25

    c=peek("port1")

      if xm>0 xm=xm-.1
      if xm<=0 xm=xm+.1
      if xm<=.2 and xm>=-.1 xm=0

         if and(c,128)<>0 xm=xm-.4
         if and(c,32)<>0 xm=xm+.4
         if and(c,8)<>0 then
         repeat
               gosub buffer
               gosub scores
               setrgb 1,ran(255),ran(255),ran(255)
               mm=mm+.1
               text 320,256+10*sin(mm),"GAME PAUSED","cc"
         until (peek("port1")<>0 and (and(peek("port1"),8)=0))
         fi
         if and(c,16384)<>0 and firedelay=0 then
            for a=1 to bullets
              if pbs(a)=0 then
                pbx(a)=plx
                pby(a)=ply
                pbs(a)=1
                a=bullets+1
                firedelay=15
                red=red+50
                grn=grn+20
                blu=blu+20
                ply=ply+5
                fill rect plx-6,ply-6 to plx+6,ply+6
               fi
            next a
         fi
         if cdt>0 cdt=cdt-1
         if and(c,2048)<>0 and shield>0 then
              setrgb 1,55,155+ran(100),55
              line plx,ply-5-sv to plx+20+sv,ply+36 +sv
              line plx,ply-5-sv to plx-20-sv,ply+36+sv
                shield=shield-2
                if shield<=0 shield=0
                cdt=cdt+1
         fi

         plx=plx+xm   

    if plx<20 then plx=20 : xm=0 :fi
    if plx>620 then plx=620 : xm=0 : fi
if ply>450 ply=ply-.5
return

'=========================================================
'  Set everything that needs setting for the new level!
'=========================================================

label nextlevel

      edr=1 : rem Enemy initial direction.
 enfdelay=0 : rem Enemy fire delay.
      enc=0 : rem Used to check how many enemys are left.
x=0
y=-200
enof=250
for a = 1 to 24
 enx(a)=x
 eny(a)=y
 ens(a)=1
 x=x+50
 if x>=400 then
    x=0
    y=y+60
 fi
next a
for a=1 to enbullets
 ebs(a)=0
next a
bspd=bspd+1
efiremx=efiremx-1
if efiremx<5 efiremx=5
if bspd>10 bspd=10
shield=shield+80
if shield>440 shield=440
return

'=========================================================
' Double buffering, Light effects, Star background.
'=========================================================

label buffer
    setdrawbuf dw
    dw=1-dw
    setdispbuf dw

     setrgb 1,red,5,5
     setrgb 2,5,grn,5
     setrgb 3,5,5,blu

       gtriangle 0,0 to 640,512 to 0,512
       gtriangle 0,0 to 640,512 to 640,0

'============
'=Starfield;=
'============

setrgb 1,10,55,255
for a=1 to stars
   fill rect strx(a),stry(a) to strx(a)+strs(a),stry(a)+strs(a)
   stry(a)=stry(a)+strs(a)
   if stry(a)>512 then strx(a)=ran(640) : stry(a)=stry(a)-512 : fi
next a

'===========
'=Lighting;=
'===========

red=red-(red/10)
grn=grn-(grn/10)
blu=blu-(blu/10)

return


' OoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO
' oOo The following parts of the program are all cal- oOo
' oOo -led with the GOTO command for speed purposes!! oOo
' oOo I have found this to be better than GOSUB.      oOo
' OoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO

'=========================================================
'     This does the nice little title screen page!
'=========================================================

label titlescreen
                  tl=255 : rem Fade message colour.
                  mess=1 : rem Reset fade message.
                     p=1 : rem Scroll text pointer.
                  fd=255 : rem Fade in variable for text.
if score>high high=score : rem New high score?

repeat
  gosub buffer
   setrgb 1,255-fd,255-fd,255-fd
   text 320,40,"-= S P A C E D   I N V A D E R S =-","cc"
   text 320,80,"-= PROGRAMMED BY MR.SHOCKWAVE =-","cc"
   rect 100,20 to 540,50
   rect 40,460 to 590,490
   rect 180,120 to 460,150
   text 320,140,"TODAYS HIGH SCORE:"+str$(high),"cc"

     text 320,220,"CONTROLS:","cc"
     text 320,240,"DPAD LEFT AND RIGHT TO MOVE YOUR SHIP","cc"
     text 320,260,"(R1) TO ACTIVATE SHIELD","cc"
     text 320,280,"(X) BUTTON TO FIRE","cc"
     text 320,300,"(START) TO PAUSE GAME","cc"
     text 320,320,"PRESS (X) TO START GAME!","cc"
     text scx,380,mid$(s$,p,67)

  scx=scx-1
  if scx<-10 then
    scx=scx+10
    p=p+1
    if p>len(s$) p=0
  fi

  setrgb 1,tl,tl,tl
  text 320,480,m$(mess),"cc"
  tl=tl-1
  if tl=0 then
    tl=255
    mess=mess+1
   if mess>10 mess=1
  fi
  if fd>0 fd=fd-1

until (and(peek("port1"),16384)<>0)
goto titleout

'=========================================================
'    Initial  game setup, Gfx screen arrays and data.
'=========================================================

label setup
   open window 640,512
     high=650 : rem Todays high score.
        red=0 : rem Red lighting effect.
        grn=0 : rem Green lighting effect.
        blu=0 : rem Blue lighting effect.
     stars=35 : rem Number of stars to have.
    bullets=3 : rem Number of player bullets allowed.
  enbullets=5 : rem maximum amount of enemy bullets.
   dim enx(24) : rem Enemys' X position.
   dim eny(24) : rem Enemys' y position.
   dim ens(24) : rem Enemy status. 1=alive 2=dying 0 dead.

   dim strx(stars) : rem Star X position.
   dim stry(stars) : rem Star Y position.
   dim strs(stars) : rem Star Speed.

   dim pbx(bullets) : rem Bullet X position.
   dim pby(bullets) : rem Bullet Y position.
   dim pbs(bullets) : rem Bullet status. (1:in use/0:off)

   dim ebx(enbullets) : rem enemy bullet x-pos.
   dim eby(enbullets) : rem enemy bullet y-pos.
   dim ebs(enbullets) : rem enemy bullet state. 1:on,0:off

for a=1 to stars
   strx(a)=ran(640)
   stry(a)=ran(640)
   strs(a)=1+ran(4)
next a

'=========================================================
'         Text Fader message for title screen!
'=========================================================

dim m$(10)
m$(1)="THIS GAME WAS PROGRAMMED IN THE YABASIC LANGUAGE"
m$(2)="IT WAS WRITTEN IN THREE DAYS IN DECEMBER 2001"
m$(3)="BY MR.SHOCKWAVE  AKA  NICK SIMPSON"
m$(4)="IF YOU ARE INTERESTED IN PROGRAMMING"
m$(5)="OR YOU WANT TO GET IN TOUCH WITH ME THEN TRY:"
m$(6)="-= WWW.YABASIC.CO.UK =-"
m$(7)="AND REGISTER ON THE FORUMS PAGE OF THAT WEBSITE"
m$(8)="YABASIC.CO.UK - THE BEST YABASIC RESOURCE ON THE NET!"
m$(9)="LOADS OF DOWNLOADS, TUTORIALS AND CODING HELP!"
m$(10)="SEE YOU THERE!"

'=========================================================
'        Scrolling text message for title screen!
'=========================================================

p=0
scx=0
s$="                                                                  "
s$=s$+"A FEW PERSONAL HANDSHAKES FROM MR.SHOCKWAVE : "
s$=s$+"ADAM LAY (WEBMASTER AT WWW.YABASIC.CO.UK) FOR A "
s$=s$+"GREAT SITE.    DOCTOR (CHRISTOPHER RANKINE) FOR "
s$=s$+"THE NICE EMAILS AND COOL PROGRAMS.     XALTHORN "
s$=s$+"(MARC GALE) FOR THE NICE PROGRAMS AND CONSTRUCTIVE"
s$=s$+" COMMENTS.     JACOB BUSBY FOR THE NICE COMMENTS "
s$=s$+"AND GREAT PROGRAMS (SETTLERS OF CATAN LOOKS ACE!) "
s$=s$+"     "
s$=s$+"RAFRYER (RICHARD FRYER) FOR THE AMAZING 3D RACER "
s$=s$+"AND INSPIRING THIS GAME, AFTER I SAW YOURS I KNEW "
s$=s$+"I'D HAVE TO DO A SPACE INVADERS TYPE GAME MYSELF!!"
s$=s$+"    PSI-2 MAGAZINE FOR PUBLISHING MY PUK MAN GAME "
s$=s$+"    JINX (GARETH BAILEY),      JO MORROW,      "
s$=s$+"MASTER TONBERRY,     MONKEYPANTS,     SEPHIROTH,"
s$=s$+"     GOTHI,     TREV,     PHILL PACKMAN,     "
s$=s$+"PAUL DUNLOP,     VICKI (MY SWEETHEART!)     "
s$=s$+"AND ALL AT WWW.YABASIC.CO.UK'S FORUMS.          "
s$=s$+"AND THAT'S ABOUT ALL I CAN REMEMBER, CHECK OUT THE"
s$=s$+" FORUMS AT YABASIC.CO.UK... IT'S A WRAP!"
goto begin

It looks old now. If you run this in the emulator make sure you sync to ps2 otherwise it will run way too fast.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Yah Spaced Invaders
« Reply #6 on: February 22, 2007 »
Ahh, yes... much practice!

It's getting late, and I've just been chatting on msn, so I guess I will try and get more done tomorrow.
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Online Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Yah Spaced Invaders
« Reply #7 on: February 22, 2007 »
Looking forward to seeing what you do :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Yah Spaced Invaders
« Reply #8 on: February 23, 2007 »
Well, today might be a problem... I need to mow 'The Lawns' and I might finish the job me and my brother started around december last year, just to get some cash before uni... eeee! lucky parents are going to pay for our accomodation and stuff!

I will see what I can do, in the future... saturday might be a problem too - need to get shopping and stuff for our move on sunday.

So, I will have a think of what I can possibly get as close as possible to the original... I think I have most of the game play thought out, so I just need to program it.
I might add debries so that you can also score off them too! But, looking at my Boxcopter effort - it might be harder than it sounds. I might just have 5 pieces falling in maybe a *randomised* set pattern.

Can't wait for the Pool game to get done - mmm, wanna break the balls! haha. And I hopefully can get this one done...

YaBASIC Games are cooool!  :updance:  :2funny:
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Yah Spaced Invaders
« Reply #9 on: February 23, 2007 »
Ok, I finished mowing awhile ago - took me 2 hours :( but it's looking great!
So, I decided to improve the likness to the original:
    Added a red shaded background with redish scrolling stars (note: is the background red of SI2?)
    Made a particle trail for the ship, looks ok, but sometimes goes funny...
That's about all I could do in half an hour... I know, not mush for that amount of time, but that's including washing The Dog: Bundy Bird (hahahaha)

I will attatch the file, and hopefully I can improve it more. I have also made (I think it works) a timer for the levels, and accuracy count to give you scores.
I just need to put in the invaders and bullet cols, bonuses and it's basically done - then I will probably make it more like the original (improve the UFO, and invader gfx)

Hope you enjoy...

*I just hope that I can do the invader positions and scrolling... I think I'll be able to code the collisions (but the method I tried when I had a scrolling invader - just the one - was really slow! like Mega Slow Down!)*
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Online Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Yah Spaced Invaders
« Reply #10 on: February 23, 2007 »
I've got to say that's looking way better!

Is scrolling all those enemies really going to slow things down a whole lot? Drawwing them might, and the collisions might but there are a few tricks to use that can speed that up...
Shockwave ^ Codigos
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Yah Spaced Invaders
« Reply #11 on: February 23, 2007 »
Thats lookin' Wicked man. I really love the scrollin starfeild, And the heads up display looks really nice too ;)

Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Yah Spaced Invaders
« Reply #12 on: February 26, 2007 »
Ok, I have started uni now... so my programmin hours might be abit littler!
So, on the weekends I'll go home (I'm on campus) and get stuck into this project and hopefully finish it quickly.
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Online Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Yah Spaced Invaders
« Reply #13 on: February 26, 2007 »
Good luck with the studying mate!
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Yah Spaced Invaders
« Reply #14 on: March 04, 2007 »
Ok, I went out clubbing on friday, so I was sick most of saturday and today I couldn't get anything done at home because a cyclone is lurking in the gulf so we had to get back up to NFIH before we got stuck at home!

So, next weekend hopefully I can get some done... if I don't have any homework haha.
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Yah Spaced Invaders
« Reply #15 on: March 04, 2007 »
Party on my friend, Life is too beautiful to sit back and watch it pass you by :cheers:

Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Yah Spaced Invaders
« Reply #16 on: May 10, 2007 »
Op!
I figured out how to make the invaders scroll properly! But. I still have a problem where the end (right side) invaders skip into the ones next to them!!! I have no idea why this is happening.
I tried to see if it was because I wasn't scrolling them to the right max... but changing when they changed direction didn't help.
I've attatched the code. And here's the movements code:
Code: [Select]
  for e=1 to enemy
    if enemy_x(e) <= 12 then
      dir = 1
      enemy_down = 1
    elsif enemy_x(e) >= 495 then
      dir = 0
      enemy_down = 1
    fi
    if enemy_down = 1 then
      for d = 1 to enemy
        enemy_y(d) = enemy_y(d) + 2
        enemy_down = 0
      next d
    fi
    if dir = 0 enemy_x(e) = enemy_x(e) - invader_speed
    if dir = 1 enemy_x(e) = enemy_x(e) + invader_speed
next e
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: Yah Spaced Invaders
« Reply #17 on: May 11, 2007 »
here you go mate it was happening because your enemy to wall collision checks were inside the for loop you were changing direction to often.

looks cool btw

Code: [Select]
sub draw_enemy_ships()

  setrgb 1, 250, 250, 250

  if enemy_x(1) <= 12 then
      dir = 1
      enemy_down = 1
  fi

  if enemy_x(30) >= 495 then
      dir = 0
      enemy_down = 1
  fi

  for e=1 to enemy

    if dir = 0 enemy_x(e) = enemy_x(e) - invader_speed
    if dir = 1 enemy_x(e) = enemy_x(e) + invader_speed

    if enemy_down = 1 then
       for d = 1 to enemy
             enemy_y(d) = enemy_y(d) + 2
             enemy_down = 0
       next d
    fi
   
    if type(e) = 1 then
      setrgb 1, 200, 0, 0
    elsif type(e) = 2 then
      setrgb 1, 0, 200, 0
    elsif type(e) = 3 then
      setrgb 1, 0, 0, 200
    elsif type(e) = 4 then
      setrgb 1, 200, 200, 200
    fi
    fill rect enemy_x(e) - 6, enemy_y(e), enemy_x(e) + 6, enemy_y(e) + 20
    setrgb 1, 250, 250, 250
    rect enemy_x(e) - 6, enemy_y(e), enemy_x(e) + 6, enemy_y(e) + 20
    enemy_checks()
  next e
end sub
Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Yah Spaced Invaders
« Reply #18 on: May 11, 2007 »
Yeah I see what you are saying. But that means that only when the first or last will cause the change in direction yeah? Meaning that the invaders won't scroll all the way across if the last / first ones have been killed? I think...

Code: [Select]
  --> dead: 7, 0, c, d, f and g


                           [6] ... is dead...
|      [1] [2] [3] [4] [5]    |
|          [8] [9]     [a] [b]|
|              [e]         [h]|

**Change - scrolling across hitting wall with 6, b and h (last of the invaders)



                           [6] ... is dead...
                           [b] ... is dead...
                           [h] ... is dead...
|      [1] [2] [3] [4] [5]    |
|          [8] [9]     [a]    |
|              [e]            |

**Changes when 6, b and h (last of the invaders), but the new 'last' invaders are not at the wall...

That's how I picture it... but I'm not sure if its the case.
But, I'll try your fix to see what happens. Thanks.
« Last Edit: May 11, 2007 by CLANKY »
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: Yah Spaced Invaders
« Reply #19 on: May 11, 2007 »
yeah of course your right mate i was just showing you why they were squashing up itll be upto you to make it work though good luck  ;)

actually you could do something like this, might work might not inside your for loop

Code: [Select]
if enemy_x(bottom_enemy) <= 12 then
      dir = 1
      enemy_down = 1
fi

if enemy_x(top_enemy) >= 495 then
      dir = 0
      enemy_down = 1
fi

highest_enemy = 12
lowest_enemy = 495
for e=1 to enemy

     rem is the enemy alive
     if enemy_status(e) = 1 then
               if enemy_x(e)>highest_enemy then
                             top_enemy = e
                             highest_enemy = enemy_x(e)
               fi
               if enemy_x(e)<lowest_enemy then
                              bottom_enemy = e
                              lowest_enemy = enemy_x(e)
              fi
     fi
next e

what this should do is reposition the highest and lowest enemy on boundres to whatever is left.

now that might need some work to get it actually working but its one way you could sort it
« Last Edit: May 11, 2007 by ninogenio »
Challenge Trophies Won: