Liberty BASIC Community Forum
« space invaders »

Welcome Guest. Please Login or Register.
Sep 21st, 2017, 7:54pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: space invaders  (Read 287 times)
bluatigro
Guru
ImageImageImageImageImage


member is offline

Avatar

cxiu diversas el tio respondas cxiu samvaloras [ thats esperanto for : we are al different therefore we are al equal ]


PM

Gender: Male
Posts: 908
xx space invaders
« Thread started on: Jul 8th, 2016, 05:06am »

try at space invaders

step 1 :
draw and move NMYs

error :
no NMYs visable

i didnt forget the mask
i wanted to make transparent sprites
Code:
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
dim st( 5,5 ) , tel(5,5)
global state , down , left , right
left = 1 : right = 2
nomainwin

open "SPACE INVADERS" for graphics as #m
  #m "trapclose [quit]"
  #m "fill white"
  #m "goto 0 100"
  #m "backcolor black"
  #m "down"
  #m "boxfilled 100 200"
  #m "up"
  #m "goto 50 150"
  #m "backcolor red"
  #m "down"
  #m "circle 50"
  #m "up"
  #m "getbmp bmpRed 0 0 100 200"
  #m "backcolor green"
  #m "down"
  #m "circle 50"
  #m "up"
  #m "getbmp bmpGreen 0 0 100 200"
  #m "fill black"
  #m "getbmp back 0 0 2 2"
  #m "background back"
  #m "flush"
  for x = 0 to 5
    for y = 0 to 5
      #m "addsprite spr";x;".";y;" bmpGreen bmpRed"
      #m "spritexy spr";x;".";y;" ";x*150+50;" ";y*120
      if rnd( 0 ) < .5 then
        #m "spriteimage spr";x;".";y;" bmpGreen"
      else
        #m "spriteimage spr";x;".";y;" bmpRed"
      end if
    next y
  next x
  timer 40 , [tmr]
[tmr]
  for x = 0 to 5
  for y = 0 to 5
  #m "spritexy? spr";x;".";y;" sx sy"
  select case st(x,y)
    case left
      #m "spritemovexy spr";x;".";y;" -2 0"
      if sx < 50 then
        st(x,y) = down
        tel(x,y) = 64
      end if
    case right
      #m "spritemovexy spr";x;".";y;" 2 0"
      if sx > WindowWidth - 164 then
        st(x,y) = down
        tel(x,y) = 64
      end if
    case else ''down
      #m "spritemovexy spr";x;".";y;" 0 1"
      if sy > WindowHeight - 64 then
        #m "spritexy spr";x;".";y;" ";sx;" -100"
      end if
      tel(x,y) = tel(x,y) - 1
      if tel(x,y) < 0 then
        if sx < 50 then
          st(x,y) = right
        else
          st(x,y) = left
        end if
      end if
  end select
  next y
  next x
  #m "drawsprites"
wait
[quit]
  close #m
end
 

User IP Logged

basic's : C64 Simons C128 Amiga Amos quick4.5 Visual5 Visual6 Visual2005 Visual2008 just and last but not least liberty
bluatigro
Guru
ImageImageImageImageImage


member is offline

Avatar

cxiu diversas el tio respondas cxiu samvaloras [ thats esperanto for : we are al different therefore we are al equal ]


PM

Gender: Male
Posts: 908
xx Re: space invaders
« Reply #1 on: Jul 8th, 2016, 05:13am »

update :
NMYs move !
Code:
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
dim st( 5,5 ) , tel(5,5)
global state , down , left , right
left = 1 : right = 2
nomainwin

open "SPACE INVADERS" for graphics as #m
  #m "trapclose [quit]"
  #m "fill white"
  #m "goto 0 100"
  #m "backcolor black"
  #m "down"
  #m "boxfilled 100 200"
  #m "up"
  #m "goto 50 150"
  #m "backcolor red"
  #m "down"
  #m "circlefilled 50"
  #m "up"
  #m "getbmp bmpRed 0 0 100 200"
  #m "backcolor green"
  #m "down"
  #m "circlefilled 50"
  #m "up"
  #m "getbmp bmpGreen 0 0 100 200"
  #m "fill black"
  #m "getbmp back 0 0 2 2"
  #m "background back"
  #m "flush"
  for x = 0 to 5
    for y = 0 to 5
      #m "addsprite spr";x;".";y;" bmpGreen bmpRed"
      #m "spritexy spr";x;".";y;" ";x*150+50;" ";y*120
      if rnd( 0 ) < .5 then
        #m "spriteimage spr";x;".";y;" bmpGreen"
      else
        #m "spriteimage spr";x;".";y;" bmpRed"
      end if
    next y
  next x
  timer 40 , [tmr]
[tmr]
  for x = 0 to 5
  for y = 0 to 5
  #m "spritexy? spr";x;".";y;" sx sy"
  select case st(x,y)
    case left
      #m "spritemovexy spr";x;".";y;" -5 0"
      if sx < 50 then
        st(x,y) = down
        tel(x,y) = 64
      end if
    case right
      #m "spritemovexy spr";x;".";y;" 5 0"
      if sx > WindowWidth - 164 then
        st(x,y) = down
        tel(x,y) = 64
      end if
    case else ''down
      #m "spritemovexy spr";x;".";y;" 0 2"
      if sy > WindowHeight - 64 then
        #m "spritexy spr";x;".";y;" ";sx;" -100"
      end if
      tel(x,y) = tel(x,y) - 5
      if tel(x,y) < 0 then
        if sx < 50 then
          st(x,y) = right
        else
          st(x,y) = left
        end if
      end if
  end select
  next y
  next x
  #m "drawsprites"
wait
[quit]
  close #m
end
 
User IP Logged

basic's : C64 Simons C128 Amiga Amos quick4.5 Visual5 Visual6 Visual2005 Visual2008 just and last but not least liberty
bluatigro
Guru
ImageImageImageImageImage


member is offline

Avatar

cxiu diversas el tio respondas cxiu samvaloras [ thats esperanto for : we are al different therefore we are al equal ]


PM

Gender: Male
Posts: 908
xx Re: space invaders
« Reply #2 on: Jul 8th, 2016, 06:01am »

update :
player added
try at fire
error :
fire not visable
Code:
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
dim st( 5,5 ) , tel(5,5)
global state , down , left , right , winx , winy
winx = WindowWidth
winy = WindowHeight
left = 1 : right = 2
nomainwin
red$=rgb$(255,0,0)
yellow$=rgb$(255,255,0)

open "SPACE INVADERS" for graphics as #m
  #m "trapclose [quit]"
  #m "fill white"
  #m "goto 0 26"
  #m "backcolor black"
  #m "down"
  #m "boxfilled 26 52"
  #m "up"
  #m "goto 13 39"
  #m "down"
  #m "backcolor red"
  #m "circlefilled ";i
  #m "up"
  #m "getbmp fire 0 0 26 52"
  #m "addsprite nmyfire fire"
  #m "spritexy nmyfire 500 300"
  #m "fill white"
  #m "goto 0 100"
  #m "backcolor black"
  #m "down"
  #m "boxfilled 100 200"
  #m "up"
  #m "goto 50 150"
  #m "backcolor green"
  #m "down"
  #m "circlefilled 50"
  #m "up"
  #m "getbmp bmpGreen 0 0 100 200"
  #m "backcolor blue"
  #m "down"
  #m "circlefilled 50"
  #m "up"
  #m "getbmp bmpBlue 0 0 100 200"
  #m "backcolor cyan"
  #m "down"
  #m "circlefilled 50"
  #m "up"
  #m "getbmp bmpCyan 0 0 100 200"
  #m "fill black"
  #m "getbmp back 0 0 2 2"
  #m "background back"
  #m "flush"
  #m "addsprite player bmpCyan"
  #m "spritexy player ";winx/2-50;" ";winy-200
  for x = 0 to 5
    for y = 0 to 5
      #m "addsprite spr";x;".";y;" bmpBlue bmpGreen"
      #m "spritexy spr";x;".";y;" ";x*150+50;" ";y*120
      if rnd( 0 ) < .5 then
        #m "spriteimage spr";x;".";y;" bmpBlue"
      else
        #m "spriteimage spr";x;".";y;" bmpGreen"
      end if
    next y
  next x
  #m "when mouseMove [move]"
  #m "setfocus"
  timer 40 , [tmr]
wait
[move]
  mouse.x = MouseX
wait
[tmr]
  #m "spritexy player ";mouse.x-50;" ";winy-200
  for x = 0 to 5
  for y = 0 to 5
  #m "spritexy? spr";x;".";y;" sx sy"
  select case st(x,y)
    case left
      #m "spritemovexy spr";x;".";y;" -5 0"
      if sx < 50 then
        st(x,y) = down
        tel(x,y) = 64
      end if
    case right
      #m "spritemovexy spr";x;".";y;" 5 0"
      if sx > WindowWidth - 164 then
        st(x,y) = down
        tel(x,y) = 64
      end if
    case else ''down
      #m "spritemovexy spr";x;".";y;" 0 2"
      if sy > WindowHeight - 64 then
        #m "spritexy spr";x;".";y;" ";sx;" -100"
      end if
      tel(x,y) = tel(x,y) - 5
      if tel(x,y) < 0 then
        if sx < 50 then
          st(x,y) = right
        else
          st(x,y) = left
        end if
      end if
  end select
  next y
  next x
  #m "drawsprites"
wait
[quit]
  close #m
end
function rgb$( r , g , b )
  r = r and 255
  g = g and 255
  b = b and 255
  rgb$ = str$(r);" ";g;" ";b
end function
function mix$(a$,f,b$)
  ar=val(word$(a$,1))
  ag=val(word$(a$,2))
  ab=val(word$(a$,3))
  br=val(word$(b$,1))
  bg=val(word$(b$,2))
  bb=val(word$(b$,3))
  r=ar+(br-ar)*f
  g=ag+(bg-ag)*f
  b=ab+(bb-ab)*f
  mix$ = rgb$(r,g,b)
end function
 
User IP Logged

basic's : C64 Simons C128 Amiga Amos quick4.5 Visual5 Visual6 Visual2005 Visual2008 just and last but not least liberty
CarlGundel
Administrator
ImageImageImageImageImage


member is offline

Avatar

author of Liberty BASIC


Homepage PM


Posts: 2833
xx Re: space invaders
« Reply #3 on: Jul 8th, 2016, 08:14am »

Fun. Can't wait to see how this develops!

-Carl
User IP Logged

author of Liberty BASIC
http://www.libertybasic.com
bluatigro
Guru
ImageImageImageImageImage


member is offline

Avatar

cxiu diversas el tio respondas cxiu samvaloras [ thats esperanto for : we are al different therefore we are al equal ]


PM

Gender: Male
Posts: 908
xx Re: space invaders
« Reply #4 on: Jul 14th, 2016, 03:54am »


update :
more nmy colors
points sprites added

error :
nmyfire not visable
points not nice

Code:
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
dim st( 5,5 ) , tel(5,5)
global state , down , left , right , winx , winy , ms , points
winx = WindowWidth
winy = WindowHeight
left = 1 : right = 2
ms = 40
nomainwin
red$=rgb$(255,0,0)
yellow$=rgb$(255,255,0)

open "SPACE INVADERS" for graphics as #m
  #m "trapclose [quit]"
  #m "font courier_new 30 bold"
  #m "fill white"
  for i = 0 to 9
    #m "goto 0 30"
    #m "color black"
    #m "backcolor white"
    #m "down"
    #m "\";i
    #m "up"
    #m "goto 0 100"
    #m "color cyan"
    #m "backcolor black"
    #m "down"
    #m "\";i
    #m "up"
    #m "getbmp digit";i;" 0 0 30 140"
    anim$ = anim$ + " digit";i
  next i
  for i = 1 to 12
    #m "addsprite digit";i;" ";anim$
    #m "spritexy digit";i;" ";500-i*30;" 30"
  next i
  #m "fill white"
  #m "goto 0 26"
  #m "color black"
  #m "backcolor black"
  #m "down"
  #m "boxfilled 26 52"
  #m "up"
  for i = 12 to 0
    call circle 13 , 39 , i , mix$(red$,i/12,yellow$)
  next i
  #m "getbmp fire 0 0 26 52"
  #m "addsprite nmyfire fire"
  #m "spritexy nmyfire 500 300"
  #m "fill white"
  #m "goto 0 100"
  #m "backcolor black"
  #m "down"
  #m "boxfilled 100 200"
  #m "up"
  call circle 50 , 150 , 50 , "red"
  #m "getbmp bmp0 0 0 100 200"
  call circle 50 , 150 , 50 , "green"
  #m "getbmp bmp1 0 0 100 200"
  call circle 50 , 150 , 50 , "blue"
  #m "getbmp bmp2 0 0 100 200"
  call circle 50 , 150 , 50 , "cyan"
  #m "getbmp bmpCyan 0 0 100 200"
  #m "fill black"
  #m "getbmp back 0 0 2 2"
  #m "background back"
  #m "flush"
  #m "addsprite player bmpCyan"
  #m "spritexy player ";winx/2-50;" ";winy-200
  for x = 0 to 5
    for y = 0 to 4
      #m "addsprite spr";x;".";y;" bmp0 bmp1 bmp2"
      #m "spritexy spr";x;".";y;" ";x*150+50;" ";y*120
      #m "spriteimage spr";x;".";y;" bmp";int(range(0,3))
    next y
  next x
  #m "when mouseMove [move]"
  #m "setfocus"
  timer ms , [timer]
wait
[move]
  mouse.x = MouseX
wait
sub nextlevel
  for x = 0 to 5
    for y = 0 to 4
      #m "spritexy spr";x;".";y;" ";x*150+50;" ";y*120
      #m "spriteimage spr";x;".";y;" bmp";int(range(0,3))
    next y
  next x
  ms = ms - 1
  timer ms , [timer]
end sub
sub circle x , y , d , kl$
  #m "goto ";x;" ";y
  #m "color ";kl$
  #m "backcolor ";kl$
  #m "down"
  #m "circlefilled ";d
  #m "up"
end sub
[timer]
  for i = 1 to 12
    #m "spriteimage digit";i;" digit0"
  next i
  for i = 1 to len( str$( points ) )
    q$ = mid$( str$( points ) , i , 1 )
    #m "spriteimage digit";i;" digit";q$
  next i
  #m "spritexy player ";mouse.x-50;" ";winy-200
  for x = 0 to 5
  for y = 0 to 4
  #m "spritexy? spr";x;".";y;" sx sy"
  select case st(x,y)
    case left
      #m "spritemovexy spr";x;".";y;" -5 0"
      if sx < 50 then
        st(x,y) = down
        tel(x,y) = 64
      end if
    case right
      #m "spritemovexy spr";x;".";y;" 5 0"
      if sx > WindowWidth - 164 then
        st(x,y) = down
        tel(x,y) = 64
      end if
    case else ''down
      #m "spritemovexy spr";x;".";y;" 0 2"
      if sy > WindowHeight - 64 then
        #m "spritexy spr";x;".";y;" ";sx;" -100"
      end if
      tel(x,y) = tel(x,y) - 5
      if tel(x,y) < 0 then
        if sx < 50 then
          st(x,y) = right
        else
          st(x,y) = left
        end if
      end if
  end select
  next y
  next x
  #m "drawsprites"
wait
[quit]
  close #m
end
function range(l,h)
  range=rnd(0)*(h-l)+l
end function
function rgb$( r , g , b )
  r = r and 255
  g = g and 255
  b = b and 255
  rgb$ = str$(r);" ";g;" ";b
end function
function mix$(a$,f,b$)
  ar=val(word$(a$,1))
  ag=val(word$(a$,2))
  ab=val(word$(a$,3))
  br=val(word$(b$,1))
  bg=val(word$(b$,2))
  bb=val(word$(b$,3))
  r=ar+(br-ar)*f
  g=ag+(bg-ag)*f
  b=ab+(bb-ab)*f
  mix$ = rgb$(r,g,b)
end function
 
User IP Logged

basic's : C64 Simons C128 Amiga Amos quick4.5 Visual5 Visual6 Visual2005 Visual2008 just and last but not least liberty
bluatigro
Guru
ImageImageImageImageImage


member is offline

Avatar

cxiu diversas el tio respondas cxiu samvaloras [ thats esperanto for : we are al different therefore we are al equal ]


PM

Gender: Male
Posts: 908
xx Re: space invaders
« Reply #5 on: Jul 14th, 2016, 04:41am »


update :
you can now fire at NMY's

error :
score isnt working right
Code:
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
dim st( 5,5 ) , tel(5,5)
global state , down , left , right , dead  , winx , winy , ms
global points , nmyfmax , nmyftel , humanfmax , humanftel
winx = WindowWidth
winy = WindowHeight
left = 1 : right = 2 : dead = 3
ms = 40
humanfmax = 20
nmyfmax = 40
nomainwin
red$=rgb$(255,0,0)
yellow$=rgb$(255,255,0)

open "SPACE INVADERS" for graphics as #m
  #m "trapclose [quit]"
  #m "font courier_new 30 bold"
  #m "fill white"
  for i = 0 to 9
    #m "goto 0 30"
    #m "color black"
    #m "backcolor white"
    #m "down"
    #m "\";i
    #m "up"
    #m "goto 0 100"
    #m "color cyan"
    #m "backcolor black"
    #m "down"
    #m "\";i
    #m "up"
    #m "getbmp digit";i;" 0 0 30 140"
    anim$ = anim$ + " digit";i
  next i
  for i = 1 to 12
    #m "addsprite digit";i;" ";anim$
    #m "spritexy digit";i;" ";500-i*30;" 30"
  next i
  #m "fill white"
  #m "goto 0 26"
  #m "color black"
  #m "backcolor red"
  #m "down"
  #m "boxfilled 26 52"
  #m "up"
''  for i = 12 to 0
''    call circle 13 , 39 , i , mix$(red$,i/12,yellow$)
''  next i
  #m "getbmp fire 0 0 26 52"
  for i = 0 to humanfmax
  #m "addsprite humanfire";i;" fire"
  next i
  #m "fill white"
  #m "goto 0 100"
  #m "backcolor black"
  #m "down"
  #m "boxfilled 100 200"
  #m "up"
  call circle 50 , 150 , 50 , "red"
  #m "getbmp bmp0 0 0 100 200"
  call circle 50 , 150 , 50 , "green"
  #m "getbmp bmp1 0 0 100 200"
  call circle 50 , 150 , 50 , "blue"
  #m "getbmp bmp2 0 0 100 200"
  call circle 50 , 150 , 50 , "cyan"
  #m "getbmp bmpCyan 0 0 100 200"
  #m "fill black"
  #m "getbmp back 0 0 2 2"
  #m "background back"
  #m "flush"
  #m "addsprite player bmpCyan"
  #m "spritexy player ";winx/2-50;" ";winy-200
  for x = 0 to 5
    for y = 0 to 4
      #m "addsprite spr";x;".";y;" bmp0 bmp1 bmp2"
      #m "spritexy spr";x;".";y;" ";x*150+50;" ";y*120
      #m "spriteimage spr";x;".";y;" bmp";int(range(0,3))
    next y
  next x
  #m "when mouseMove [move]"
  #m "when leftButtonUp [leftup]"
  #m "setfocus"
  timer ms , [timer]
wait
[move]
  mouse.x = MouseX
wait
[leftup]
  #m "spritexy? player x y"
  #m "spritexy humanfire";humanftel;" ";x-30;" ";y
  #m "spritemovexy humanfire";humanftel;" 0 -5"
  humanftel = ( humanftel + 1 ) mod humanfmax
wait
sub nextlevel
  for x = 0 to 5
    for y = 0 to 4
      #m "spritexy spr";x;".";y;" ";x*150+50;" ";y*120
      #m "spriteimage spr";x;".";y;" bmp";int(range(0,3))
      st(x,y)=right
    next y
  next x
  ms = ms - 1
  timer ms , [timer]
end sub
sub circle x , y , d , kl$
  #m "goto ";x;" ";y
  #m "color ";kl$
  #m "backcolor ";kl$
  #m "down"
  #m "circlefilled ";d
  #m "up"
end sub
[timer]
  for i = 1 to 12
    #m "spriteimage digit";i;" digit0"
  next i
  for i = 1 to len( str$( points ) )
    q$ = mid$( str$( points ) , i , 1 )
    #m "spriteimage digit";i;" digit";q$
  next i
  #m "spritexy player ";mouse.x-50;" ";winy-200
  for x = 0 to 5
  for y = 0 to 4
  #m "spritexy? spr";x;".";y;" sx sy"
  #m "spritecollides spr";x;".";y;" hit$"
  if instr( hit$ , "humanfire" ) then
    st(x,y) = dead
    q$ = mid$( word$( hit$ , 1 ) , 10 )
    #m "spritexy humanfire";q$;" -200 200"
    #m "spritemovexy humanfire";q$;" 0 0"
    points = points + 1
  end if
  select case st(x,y)
    case left
      #m "spritemovexy spr";x;".";y;" -5 0"
      if sx < 50 then
        st(x,y) = down
        tel(x,y) = 64
      end if
    case right
      #m "spritemovexy spr";x;".";y;" 5 0"
      if sx > WindowWidth - 164 then
        st(x,y) = down
        tel(x,y) = 64
      end if
    case dead
      #m "spritexy spr";x;".";y;" -200 0"
      #m "spritemovexy spr";x;".";y;" 0 0"
    case else ''down
      #m "spritemovexy spr";x;".";y;" 0 2"
      if sy > WindowHeight - 64 then
        #m "spritexy spr";x;".";y;" ";sx;" -100"
      end if
      tel(x,y) = tel(x,y) - 5
      if tel(x,y) < 0 then
        if sx < 50 then
          st(x,y) = right
        else
          st(x,y) = left
        end if
      end if
  end select
  next y
  next x
  #m "drawsprites"
wait
[quit]
  close #m
end
function range(l,h)
  range=rnd(0)*(h-l)+l
end function
function rgb$( r , g , b )
  r = r and 255
  g = g and 255
  b = b and 255
  rgb$ = str$(r);" ";g;" ";b
end function
function mix$(a$,f,b$)
  ar=val(word$(a$,1))
  ag=val(word$(a$,2))
  ab=val(word$(a$,3))
  br=val(word$(b$,1))
  bg=val(word$(b$,2))
  bb=val(word$(b$,3))
  r=ar+(br-ar)*f
  g=ag+(bg-ag)*f
  b=ab+(bb-ab)*f
  mix$ = rgb$(r,g,b)
end function
 
User IP Logged

basic's : C64 Simons C128 Amiga Amos quick4.5 Visual5 Visual6 Visual2005 Visual2008 just and last but not least liberty
bluatigro
Guru
ImageImageImageImageImage


member is offline

Avatar

cxiu diversas el tio respondas cxiu samvaloras [ thats esperanto for : we are al different therefore we are al equal ]


PM

Gender: Male
Posts: 908
xx Re: space invaders
« Reply #6 on: Jul 14th, 2016, 10:27am »


update :
nmyfire added

error :
the code stops somtimes

Code:
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
dim st( 5,5 ) , tel(5,5)
global state , down , left , right , dead  , winx , winy , ms
global points , nmyfmax , nmyftel , humanfmax , humanftel
winx = WindowWidth
winy = WindowHeight
left = 1 : right = 2 : dead = 3
ms = 40
humanfmax = 20
nmyfmax = 40
level = 10
nomainwin
red$=rgb$(255,0,0)
yellow$=rgb$(255,255,0)

open "SPACE INVADERS" for graphics as #m
  #m "trapclose [quit]"
  #m "font courier_new 30 bold"
  #m "fill white"
  for i = 0 to 9
    #m "goto 0 30"
    #m "color black"
    #m "backcolor white"
    #m "down"
    #m "\";i
    #m "up"
    #m "goto 0 100"
    #m "color cyan"
    #m "backcolor black"
    #m "down"
    #m "\";i
    #m "up"
    #m "getbmp digit";i;" 0 0 30 140"
    anim$ = anim$ + " digit";i
  next i
  for i = 1 to 12
    #m "addsprite digit";i;" ";anim$
    #m "spritexy digit";i;" ";500-i*30;" 30"
  next i
  #m "fill white"
  #m "goto 0 26"
  #m "color black"
  #m "backcolor red"
  #m "down"
  #m "boxfilled 26 52"
  #m "up"
''  for i = 12 to 0
''    call circle 13 , 39 , i , mix$(red$,i/12,yellow$)
''  next i
  #m "getbmp fire 0 0 26 52"
  for i = 0 to humanfmax
    #m "addsprite humanfire";i;" fire"
  next i
  for i = 0 to nmyfmax
    #m "addsprite nmyfire";i;" fire"
  next i
  #m "fill white"
  #m "goto 0 100"
  #m "backcolor black"
  #m "down"
  #m "boxfilled 100 200"
  #m "up"
  call circle 50 , 150 , 50 , "red"
  #m "getbmp bmp0 0 0 100 200"
  call circle 50 , 150 , 50 , "green"
  #m "getbmp bmp1 0 0 100 200"
  call circle 50 , 150 , 50 , "blue"
  #m "getbmp bmp2 0 0 100 200"
  call circle 50 , 150 , 50 , "cyan"
  #m "getbmp bmpCyan 0 0 100 200"
  #m "fill black"
  #m "getbmp back 0 0 2 2"
  #m "background back"
  #m "flush"
  #m "addsprite player bmpCyan"
  #m "spritexy player ";winx/2-50;" ";winy-200
  for x = 0 to 5
    for y = 0 to 4
      #m "addsprite spr";x;".";y;" bmp0 bmp1 bmp2"
      #m "spritexy spr";x;".";y;" ";x*150+50;" ";y*120
      #m "spriteimage spr";x;".";y;" bmp";int(range(0,3))
    next y
  next x
  #m "when mouseMove [move]"
  #m "when leftButtonUp [leftup]"
  #m "setfocus"
  timer ms , [timer]
wait
[move]
  mouse.x = MouseX
wait
[leftup]
  #m "spritexy? player x y"
  #m "spritexy humanfire";humanftel;" ";x-30;" ";y
  #m "spritemovexy humanfire";humanftel;" 0 -5"
  humanftel = ( humanftel + 1 ) mod humanfmax
wait
sub nextlevel
  for x = 0 to 5
    for y = 0 to 4
      #m "spritexy spr";x;".";y;" ";x*150+50;" ";y*120
      #m "spriteimage spr";x;".";y;" bmp";int(range(0,3))
      st(x,y)=right
    next y
  next x
  ms = ms - 1
  if level < nmyfmax then
    level = level + 5
  end if
  timer ms , [timer]
end sub
sub circle x , y , d , kl$
  #m "goto ";x;" ";y
  #m "color ";kl$
  #m "backcolor ";kl$
  #m "down"
  #m "circlefilled ";d
  #m "up"
end sub
[timer]
  for i = 1 to 12
    #m "spriteimage digit";i;" digit0"
  next i
  for i = 1 to len( str$( points ) )
    q$ = mid$( str$( points ) , i , 1 )
    #m "spriteimage digit";i;" digit";q$
  next i
  #m "spritexy player ";mouse.x-50;" ";winy-200
  for i = 0 to level
    #m "spritexy? nmyfire";i;" a b"
    if b > winy then
      #m "spritemovexy nmyfire";i;" 0 0"
    end if
  next i
  #m "spritecollides player hit$"
  if hit$ <> "" then goto [quit]
  for x = 0 to 5
  for y = 0 to 4
  #m "spritexy? spr";x;".";y;" sx sy"
  if rnd(0)<0.0001 then
    #m "spritexy nmyfire" _
    ;nmyftel;" ";sx;" ";sy
    #m "spritemovexy nmyfire" _
    ;nmyftel;" 0 6"
    nmyftel = ( nmyftel + 1 ) mod level
  end if
  #m "spritecollides spr";x;".";y;" hit$"
  if instr( hit$ , "humanfire" ) then
    st(x,y) = dead
    q$ = mid$( word$( hit$ , 1 ) , 10 )
    #m "spritexy humanfire";q$;" -200 200"
    #m "spritemovexy humanfire";q$;" 0 0"
    points = points + 1
  end if
  select case st(x,y)
    case left
      #m "spritemovexy spr";x;".";y;" -5 0"
      if sx < 50 then
        st(x,y) = down
        tel(x,y) = 64
      end if
    case right
      #m "spritemovexy spr";x;".";y;" 5 0"
      if sx > WindowWidth - 164 then
        st(x,y) = down
        tel(x,y) = 64
      end if
    case dead
      #m "spritexy spr";x;".";y;" -200 0"
      #m "spritemovexy spr";x;".";y;" 0 0"
    case else ''down
      #m "spritemovexy spr";x;".";y;" 0 2"
      if sy > WindowHeight - 64 then
        #m "spritexy spr";x;".";y;" ";sx;" -100"
      end if
      tel(x,y) = tel(x,y) - 5
      if tel(x,y) < 0 then
        if sx < 50 then
          st(x,y) = right
        else
          st(x,y) = left
        end if
      end if
  end select
  next y
  next x
  #m "drawsprites"
wait
[quit]
  close #m
end
function range(l,h)
  range=rnd(0)*(h-l)+l
end function
function rgb$( r , g , b )
  r = r and 255
  g = g and 255
  b = b and 255
  rgb$ = str$(r);" ";g;" ";b
end function
function mix$(a$,f,b$)
  ar=val(word$(a$,1))
  ag=val(word$(a$,2))
  ab=val(word$(a$,3))
  br=val(word$(b$,1))
  bg=val(word$(b$,2))
  bb=val(word$(b$,3))
  r=ar+(br-ar)*f
  g=ag+(bg-ag)*f
  b=ab+(bb-ab)*f
  mix$ = rgb$(r,g,b)
end function


 
User IP Logged

basic's : C64 Simons C128 Amiga Amos quick4.5 Visual5 Visual6 Visual2005 Visual2008 just and last but not least liberty
cundo
Guru
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 626
xx Re: space invaders
« Reply #7 on: Jul 14th, 2016, 6:33pm »

You can see why it stops adding a print Code:
[quit]
    print "hit$: " ;hit$
  close #m
end 

Basically the player collides with its own gun fire.

User IP Logged

cundo
bluatigro
Guru
ImageImageImageImageImage


member is offline

Avatar

cxiu diversas el tio respondas cxiu samvaloras [ thats esperanto for : we are al different therefore we are al equal ]


PM

Gender: Male
Posts: 908
xx Re: space invaders
« Reply #8 on: Jul 18th, 2016, 05:07am »

@cundo :
player now not hit by own fire
update :
more levels
what shoot happen :
move your tank whit mouse
shoot whit left mouse buttom
if al are shot
nextwave wil come faster
error :
points not nice
somtimes code stops
Code:
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
dim st( 5,5 ) , tel(5,5)
global state , down , left , right , dead  , winx , winy , ms
global points , nmyfmax , nmyftel , humanfmax , humanftel
winx = WindowWidth
winy = WindowHeight
left = 1 : right = 2 : dead = 3
ms = 40
humanfmax = 20
nmyfmax = 40
level = 10
nomainwin
red$=rgb$(255,0,0)
yellow$=rgb$(255,255,0)

open "SPACE INVADERS" for graphics as #m
  #m "trapclose [quit]"
  #m "font courier_new 30 bold"
  #m "fill white"
  for i = 0 to 9
    #m "goto 0 30"
    #m "color black"
    #m "backcolor white"
    #m "down"
    #m "\";i
    #m "up"
    #m "goto 0 100"
    #m "color cyan"
    #m "backcolor black"
    #m "down"
    #m "\";i
    #m "up"
    #m "getbmp digit";i;" 0 0 30 140"
    anim$ = anim$ + " digit";i
  next i
  for i = 1 to 12
    #m "addsprite digit";i;" ";anim$
    #m "spritexy digit";i;" ";500-i*30;" 30"
  next i
  #m "fill white"
  #m "goto 0 26"
  #m "color black"
  #m "backcolor red"
  #m "down"
  #m "boxfilled 26 52"
  #m "up"
''  for i = 12 to 0
''    call circle 13 , 39 , i , mix$(red$,i/12,yellow$)
''  next i
  #m "getbmp fire 0 0 26 52"
  for i = 0 to humanfmax
    #m "addsprite humanfire";i;" fire"
  next i
  for i = 0 to nmyfmax
    #m "addsprite nmyfire";i;" fire"
  next i
  #m "fill white"
  #m "goto 0 100"
  #m "backcolor black"
  #m "down"
  #m "boxfilled 100 200"
  #m "up"
  call circle 50 , 150 , 50 , "red"
  #m "getbmp bmp0 0 0 100 200"
  call circle 50 , 150 , 50 , "green"
  #m "getbmp bmp1 0 0 100 200"
  call circle 50 , 150 , 50 , "blue"
  #m "getbmp bmp2 0 0 100 200"
  call circle 50 , 150 , 50 , "cyan"
  #m "getbmp bmpCyan 0 0 100 200"
  #m "fill black"
  #m "getbmp back 0 0 2 2"
  #m "background back"
  #m "flush"
  #m "addsprite player bmpCyan"
  #m "spritexy player ";winx/2-50;" ";winy-200
  for x = 0 to 5
    for y = 0 to 4
      #m "addsprite spr";x;".";y;" bmp0 bmp1 bmp2"
      #m "spritexy spr";x;".";y;" ";x*150+50;" ";y*120
      #m "spriteimage spr";x;".";y;" bmp";int(range(0,3))
    next y
  next x
  #m "when mouseMove [move]"
  #m "when leftButtonUp [leftup]"
  #m "setfocus"
  timer ms , [timer]
wait
[move]
  mouse.x = MouseX
wait
[leftup]
  #m "spritexy? player x y"
  #m "spritexy humanfire";humanftel;" ";x-30;" ";y
  #m "spritemovexy humanfire";humanftel;" 0 -5"
  humanftel = ( humanftel + 1 ) mod humanfmax
wait
sub nextlevel
  for x = 0 to 5
    for y = 0 to 4
      #m "spritexy spr";x;".";y;" ";x*150+50;" ";y*120
      #m "spriteimage spr";x;".";y;" bmp";int(range(0,3))
      st(x,y)=right
    next y
  next x
  ms = ms - 1
  if level < nmyfmax then
    level = level + 5
  end if
  timer ms , [timer]
end sub
sub circle x , y , d , kl$
  #m "goto ";x;" ";y
  #m "color ";kl$
  #m "backcolor ";kl$
  #m "down"
  #m "circlefilled ";d
  #m "up"
end sub
[timer]
  for i = 1 to 12
    #m "spriteimage digit";i;" digit0"
  next i
  for i = 1 to len( str$( points ) )
    q$ = mid$( str$( points ) , i , 1 )
    #m "spriteimage digit";i;" digit";q$
  next i
  #m "spritexy player ";mouse.x-50;" ";winy-200
  for i = 0 to level
    #m "spritexy? nmyfire";i;" a b"
    if b > winy then
      #m "spritemovexy nmyfire";i;" 0 0"
    end if
  next i
  #m "spritecollides player hit$"
  if hit$ <> "" then
    if not( instr( hit$ , "player" ) ) then
      goto [quit]
    end if
  end if
  alldead = 1
  for x = 0 to 5
  for y = 0 to 4
  #m "spritexy? spr";x;".";y;" sx sy"
  if rnd(0)<0.0001 then
    #m "spritexy nmyfire" _
    ;nmyftel;" ";sx;" ";sy
    #m "spritemovexy nmyfire" _
    ;nmyftel;" 0 6"
    nmyftel = ( nmyftel + 1 ) mod level
  end if
  #m "spritecollides spr";x;".";y;" hit$"
  if instr( hit$ , "humanfire" ) then
    st(x,y) = dead
    q$ = mid$( word$( hit$ , 1 ) , 10 )
    #m "spritexy humanfire";q$;" -200 200"
    #m "spritemovexy humanfire";q$;" 0 0"
    points = points + 1
  end if
  select case st(x,y)
    case left
      #m "spritemovexy spr";x;".";y;" -5 0"
      if sx < 50 then
        st(x,y) = down
        tel(x,y) = 64
      end if
      alldead = 0
    case right
      #m "spritemovexy spr";x;".";y;" 5 0"
      if sx > WindowWidth - 164 then
        st(x,y) = down
        tel(x,y) = 64
      end if
      alldead = 0
    case dead
      #m "spritexy spr";x;".";y;" -200 0"
      #m "spritemovexy spr";x;".";y;" 0 0"
    case else ''down
      #m "spritemovexy spr";x;".";y;" 0 2"
      if sy > WindowHeight - 64 then
        #m "spritexy spr";x;".";y;" ";sx;" -100"
      end if
      tel(x,y) = tel(x,y) - 5
      if tel(x,y) < 0 then
        if sx < 50 then
          st(x,y) = right
        else
          st(x,y) = left
        end if
      end if
      alldead = 0
  end select
  next y
  next x
  if alldead then call nextlevel
  #m "drawsprites"
wait
[quit]
  close #m
end
function range(l,h)
  range=rnd(0)*(h-l)+l
end function
function rgb$( r , g , b )
  r = r and 255
  g = g and 255
  b = b and 255
  rgb$ = str$(r);" ";g;" ";b
end function
function mix$(a$,f,b$)
  ar=val(word$(a$,1))
  ag=val(word$(a$,2))
  ab=val(word$(a$,3))
  br=val(word$(b$,1))
  bg=val(word$(b$,2))
  bb=val(word$(b$,3))
  r=ar+(br-ar)*f
  g=ag+(bg-ag)*f
  b=ab+(bb-ab)*f
  mix$ = rgb$(r,g,b)
end function
 
User IP Logged

basic's : C64 Simons C128 Amiga Amos quick4.5 Visual5 Visual6 Visual2005 Visual2008 just and last but not least liberty
CarlGundel
Administrator
ImageImageImageImageImage


member is offline

Avatar

author of Liberty BASIC


Homepage PM


Posts: 2833
xx Re: space invaders
« Reply #9 on: Jul 18th, 2016, 07:07am »

Nice. Here are a couple of suggestions. Maybe they are easy.

In the original Space Invaders game, the fewer aliens that were left the faster it would go.

Also about your own missiles, put some sort of limiter on them so there can only be one or two of them on the screen. Also make them much faster, so that it only take a second or two for each one to reach the top of the screen.

It's amazing to see what can be done without writing tons of code. smiley

-Carl
User IP Logged

author of Liberty BASIC
http://www.libertybasic.com
bluatigro
Guru
ImageImageImageImageImage


member is offline

Avatar

cxiu diversas el tio respondas cxiu samvaloras [ thats esperanto for : we are al different therefore we are al equal ]


PM

Gender: Male
Posts: 908
xx Re: space invaders
« Reply #10 on: Jul 19th, 2016, 06:32am »

@ carl :
it was easy to do your sugestions

update
les NMY's more speed
humanfire max bulits les

error :
stil the same error's
Code:
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
dim st( 5,5 ) , tel(5,5)
global state , down , left , right , dead  , winx , winy , ms
global points , nmyfmax , nmyftel , humanfmax , humanftel , speed , tel
winx = WindowWidth
winy = WindowHeight
left = 1 : right = 2 : dead = 3
ms = 40
humanfmax = 7
nmyfmax = 40
level = 5
nomainwin

open "SPACE INVADERS" for graphics as #m
  #m "trapclose [quit]"
  #m "font courier_new 30 bold"
  #m "fill white"
  for i = 0 to 9
    #m "goto 0 30"
    #m "color black"
    #m "backcolor white"
    #m "down"
    #m "\";i
    #m "up"
    #m "goto 0 100"
    #m "color cyan"
    #m "backcolor black"
    #m "down"
    #m "\";i
    #m "up"
    #m "getbmp digit";i;" 0 0 30 140"
    anim$ = anim$ + " digit";i
  next i
  for i = 1 to 12
    #m "addsprite digit";i;" ";anim$
    #m "spritexy digit";i;" ";500-i*30;" 30"
  next i
  #m "fill white"
  #m "goto 0 26"
  #m "color black"
  #m "backcolor red"
  #m "down"
  #m "boxfilled 26 52"
  #m "up"
''  for i = 12 to 0
''    call circle 13 , 39 , i , mix$(red$,i/12,yellow$)
''  next i
  #m "getbmp fire 0 0 26 52"
  for i = 0 to humanfmax
    #m "addsprite humanfire";i;" fire"
  next i
  for i = 0 to nmyfmax
    #m "addsprite nmyfire";i;" fire"
  next i
  #m "fill white"
  #m "goto 0 100"
  #m "backcolor black"
  #m "down"
  #m "boxfilled 100 200"
  #m "up"
  call circle 50 , 150 , 50 , "red"
  #m "getbmp bmp0 0 0 100 200"
  call circle 50 , 150 , 50 , "green"
  #m "getbmp bmp1 0 0 100 200"
  call circle 50 , 150 , 50 , "blue"
  #m "getbmp bmp2 0 0 100 200"
  call circle 50 , 150 , 50 , "cyan"
  #m "getbmp bmpCyan 0 0 100 200"
  #m "fill black"
  #m "getbmp back 0 0 2 2"
  #m "background back"
  #m "flush"
  #m "addsprite player bmpCyan"
  #m "spritexy player ";winx/2-50;" ";winy-200
  for x = 0 to 5
    for y = 0 to 4
      #m "addsprite spr";x;".";y;" bmp0 bmp1 bmp2"
      #m "spritexy spr";x;".";y;" ";x*150+50;" ";y*120
      #m "spriteimage spr";x;".";y;" bmp";int(range(0,3))
    next y
  next x
  #m "when mouseMove [move]"
  #m "when leftButtonUp [leftup]"
  #m "setfocus"
  timer ms , [timer]
wait
[move]
  mouse.x = MouseX
wait
[leftup]
  #m "spritexy? player x y"
  #m "spritexy humanfire";humanftel;" ";x-30;" ";y-30
  #m "spritemovexy humanfire";humanftel;" 0 -15"
  humanftel = ( humanftel + 1 ) mod humanfmax
wait
sub nextlevel
  for x = 0 to 5
    for y = 0 to 4
      #m "spritexy spr";x;".";y;" ";x*150+50;" ";y*120
      #m "spriteimage spr";x;".";y;" bmp";int(range(0,3))
      st(x,y)=right
    next y
  next x
  ms = ms - 1
  if level < nmyfmax then
    level = level + 5
  end if
  speed = 5
  timer ms , [timer]
end sub
sub circle x , y , d , kl$
  #m "goto ";x;" ";y
  #m "color ";kl$
  #m "backcolor ";kl$
  #m "down"
  #m "circlefilled ";d
  #m "up"
end sub
[timer]
  for i = 1 to 12
    #m "spriteimage digit";i;" digit0"
  next i
  for i = 1 to len( str$( points ) )
    q$ = mid$( str$( points ) , i , 1 )
    #m "spriteimage digit";i;" digit";q$
  next i
  #m "spritexy player ";mouse.x-50;" ";winy-200
  for i = 0 to level
    #m "spritexy? nmyfire";i;" a b"
    if b > winy then
      #m "spritemovexy nmyfire";i;" 0 0"
    end if
  next i
  #m "spritecollides player hit$"
  if hit$ <> "" then
    if not( instr( hit$ , "player" ) ) then
      goto [quit]
    end if
  end if
  alldead = 1
  tel = 0
  for x = 0 to 5
  for y = 0 to 4
  #m "spritexy? spr";x;".";y;" sx sy"
  if rnd(0)<0.0001 then
    #m "spritexy nmyfire" _
    ;nmyftel;" ";sx;" ";sy
    #m "spritemovexy nmyfire" _
    ;nmyftel;" 0 6"
    nmyftel = ( nmyftel + 1 ) mod level
  end if
  #m "spritecollides spr";x;".";y;" hit$"
  if instr( hit$ , "humanfire" ) then
    st(x,y) = dead
    q$ = mid$( word$( hit$ , 1 ) , 10 )
    #m "spritexy humanfire";q$;" -200 200"
    #m "spritemovexy humanfire";q$;" 0 0"
    points = points + 1
  end if
  select case st(x,y)
    case left
      #m "spritemovexy spr";x;".";y;" -";speed;" 0"
      if sx < 50 then
        st(x,y) = down
        tel(x,y) = 64
      end if
      alldead = 0
      tel=tel+1
    case right
      #m "spritemovexy spr";x;".";y;" ";speed;" 0"
      if sx > WindowWidth - 164 then
        st(x,y) = down
        tel(x,y) = 64
      end if
      alldead = 0
      tel=tel+1
    case dead
      #m "spritexy spr";x;".";y;" -200 0"
      #m "spritemovexy spr";x;".";y;" 0 0"
    case else ''down
      #m "spritemovexy spr";x;".";y;" 0 2"
      if sy > WindowHeight - 64 then
        #m "spritexy spr";x;".";y;" ";sx;" -100"
      end if
      tel(x,y) = tel(x,y) - 5
      if tel(x,y) < 0 then
        if sx < 50 then
          st(x,y) = right
        else
          st(x,y) = left
        end if
      end if
      alldead = 0
      tel=tel+1
  end select
  next y
  next x
  if alldead then call nextlevel
  if tel < 15 then speed = 10
  if tel < 7 then speed = 15
  #m "drawsprites"
wait
[quit]
  close #m
end
function range(l,h)
  range=rnd(0)*(h-l)+l
end function
 
User IP Logged

basic's : C64 Simons C128 Amiga Amos quick4.5 Visual5 Visual6 Visual2005 Visual2008 just and last but not least liberty
cundo
Guru
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 626
xx Re: space invaders
« Reply #11 on: Jul 19th, 2016, 8:48pm »

The score, by some trial and error:
Code:
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
dim st( 5,5 ) , tel(5,5)
global state , down , left , right , dead  , winx , winy , ms
global points , nmyfmax , nmyftel , humanfmax , humanftel , speed , tel
winx = WindowWidth
winy = WindowHeight
left = 1 : right = 2 : dead = 3
ms = 40
humanfmax = 7
nmyfmax = 40
level = 5
nomainwin

open "SPACE INVADERS" for graphics as #m
  #m "trapclose [quit]"

    #m "fill white"
    #m "font courier_new 30 30 bold" '!!!!!!!!!
  for i = 0 to 9
    #m "goto 0 30"
    #m "color black"
    #m "backcolor white"
    #m "down"
    #m "\";i
    #m "up"
    #m "goto 0 100"
    #m "color cyan"
    #m "backcolor black"
    #m "down"
    #m "\";i
    #m "up"
    #m "getbmp digit";i;" 0 55 30 50" '!!!!!!!!!
    anim$ = anim$ + " digit";i
  next i

  for i = 1 to 12
    #m "addsprite digit";i;" ";anim$
    #m "spritexy digit";i;" ";500-i*30;" 30"
  next i
  #m "fill white"
  #m "goto 0 26"
  #m "color black"
  #m "backcolor red"
  #m "down"
  #m "boxfilled 26 52"
  #m "up"
''  for i = 12 to 0
''    call circle 13 , 39 , i , mix$(red$,i/12,yellow$)
''  next i
  #m "getbmp fire 0 0 26 52"
  for i = 0 to humanfmax
    #m "addsprite humanfire";i;" fire"
  next i
  for i = 0 to nmyfmax
    #m "addsprite nmyfire";i;" fire"
  next i
  #m "fill white"
  #m "goto 0 100"
  #m "backcolor black"
  #m "down"
  #m "boxfilled 100 200"
  #m "up"
  call circle 50 , 150 , 50 , "red"
  #m "getbmp bmp0 0 0 100 200"
  call circle 50 , 150 , 50 , "green"
  #m "getbmp bmp1 0 0 100 200"
  call circle 50 , 150 , 50 , "blue"
  #m "getbmp bmp2 0 0 100 200"
  call circle 50 , 150 , 50 , "cyan"
  #m "getbmp bmpCyan 0 0 100 200"
  #m "fill black"
  #m "getbmp back 0 0 2 2"
  #m "background back"
  #m "flush"
  #m "addsprite player bmpCyan"
  #m "spritexy player ";winx/2-50;" ";winy-200
  for x = 0 to 5
    for y = 0 to 4
      #m "addsprite spr";x;".";y;" bmp0 bmp1 bmp2"
      #m "spritexy spr";x;".";y;" ";x*150+50;" ";y*120
      #m "spriteimage spr";x;".";y;" bmp";int(range(0,3))
    next y
  next x
  #m "when mouseMove [move]"
  #m "when leftButtonUp [leftup]"
  #m "setfocus"
  timer ms , [timer]
wait
[move]
  mouse.x = MouseX
wait
[leftup]
  #m "spritexy? player x y"
  #m "spritexy humanfire";humanftel;" ";x-30;" ";y-30
  #m "spritemovexy humanfire";humanftel;" 0 -15"
  humanftel = ( humanftel + 1 ) mod humanfmax
wait
sub nextlevel
  for x = 0 to 5
    for y = 0 to 4
      #m "spritexy spr";x;".";y;" ";x*150+50;" ";y*120
      #m "spriteimage spr";x;".";y;" bmp";int(range(0,3))
      st(x,y)=right
    next y
  next x
  ms = ms - 1
  if level < nmyfmax then
    level = level + 5
  end if
  speed = 5
  timer ms , [timer]
end sub
sub circle x , y , d , kl$
  #m "goto ";x;" ";y
  #m "color ";kl$
  #m "backcolor ";kl$
  #m "down"
  #m "circlefilled ";d
  #m "up"
end sub
[timer]
  for i = 1 to 12
    #m "spriteimage digit";i;" digit0"
  next i
  for i = 1 to len( str$( points ) )
    q$ = mid$( str$( points ) , i , 1 )
    #m "spriteimage digit";i;" digit";q$
  next i
  #m "spritexy player ";mouse.x-50;" ";winy-200
  for i = 0 to level
    #m "spritexy? nmyfire";i;" a b"
    if b > winy then
      #m "spritemovexy nmyfire";i;" 0 0"
    end if
  next i
  #m "spritecollides player hit$"
  if hit$ <> "" then
    if not( instr( hit$ , "player" ) ) then
      goto [quit]
    end if
  end if
  alldead = 1
  tel = 0
  for x = 0 to 5
  for y = 0 to 4
  #m "spritexy? spr";x;".";y;" sx sy"
  if rnd(0)<0.0001 then
    #m "spritexy nmyfire" _
    ;nmyftel;" ";sx;" ";sy
    #m "spritemovexy nmyfire" _
    ;nmyftel;" 0 6"
    nmyftel = ( nmyftel + 1 ) mod level
  end if
  #m "spritecollides spr";x;".";y;" hit$"
  if instr( hit$ , "humanfire" ) then
    st(x,y) = dead
    q$ = mid$( word$( hit$ , 1 ) , 10 )
    #m "spritexy humanfire";q$;" -200 200"
    #m "spritemovexy humanfire";q$;" 0 0"
    points = points + 1
  end if
  select case st(x,y)
    case left
      #m "spritemovexy spr";x;".";y;" -";speed;" 0"
      if sx < 50 then
        st(x,y) = down
        tel(x,y) = 64
      end if
      alldead = 0
      tel=tel+1
    case right
      #m "spritemovexy spr";x;".";y;" ";speed;" 0"
      if sx > WindowWidth - 164 then
        st(x,y) = down
        tel(x,y) = 64
      end if
      alldead = 0
      tel=tel+1
    case dead
      #m "spritexy spr";x;".";y;" -200 0"
      #m "spritemovexy spr";x;".";y;" 0 0"
    case else ''down
      #m "spritemovexy spr";x;".";y;" 0 2"
      if sy > WindowHeight - 64 then
        #m "spritexy spr";x;".";y;" ";sx;" -100"
      end if
      tel(x,y) = tel(x,y) - 5
      if tel(x,y) < 0 then
        if sx < 50 then
          st(x,y) = right
        else
          st(x,y) = left
        end if
      end if
      alldead = 0
      tel=tel+1
  end select
  next y
  next x
  if alldead then call nextlevel
  if tel < 15 then speed = 10
  if tel < 7 then speed = 15
  #m "drawsprites"
wait
[quit]
  close #m
end
function range(l,h)
  range=rnd(0)*(h-l)+l
end function

 


User IP Logged

cundo
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls