ANAGRAM

Start hier uw open source projecten

ANAGRAM

Berichtdoor bluatigro » zo feb 28, 2010 6:04 pm

eerst maak je letter sptites

pas het path aan !!!

Code: Selecteer alles
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
global pi
pi = atn( 1 ) * 4
nomainwin
open "Sprites Test" for graphics as #m
  #m "trapclose [quit]"
  #m "font Courier_New 40 bold"
  for i = 0 to 26
''DRAW EMPTY SPRITE
    #m "cls"
    #m "color white"
    #m "backcolor white"
    #m "goto 0 0"
    #m "down"
    #m "boxfilled 63 63"
    #m "up"
    #m "goto 0 63"        '<<<<<< bugfixed Gordon was "goto 0 64"
    #m "down"
    #m "color black"
    #m "backcolor black"
    #m "boxfilled 63 127"
    #m "up"
''DRAW SPRITE
    #m "color black"
    #m "backcolor white"
    #m "goto 0 47"
    #m "\" + chr$( asc( "A" ) + i )
    #m "color blue"
    #m "backcolor black"
    #m "goto 0 110"
    #m "\" + chr$( asc( "A" ) + i )
''SAVE SPRITE
    #m "getbmp bmp 0 0 63 127"
    bmpsave "bmp", "D:\BASIC_LIBERTY\BMP\chr" _
    + nr$( i , 2 ) + ".bmp"
    #m "flush"
  next i
wait
function nr$( no , max )
  nr$ = right$( "00000000" + str$( no ) , max )
end function
[quit]
  close #m
end

sub elipse x , y , dx , dx , clr$
  if clr$ = "nocolor" then
    #m "goto " ; x ; " " ; y
    #m "color white"
    #m "backcolor white"
    #m "down"
    #m "ellipsefilled " ; dx ; " " ; dy
    #m "up"
    #m "goto " ; x ; " " ; y + 64
    #m "color black"
    #m "backcolor black"
    #m "down"
    #m "ellipsefilled " ; dx ; " " ; dy
  else
    #m "goto " ; x ; " " ; y + 64
    #m "color " ; clr$
    #m "backcolor " ; clr$
    #m "down"
    #m "ellipsefilled " ; dx ; " " ; dy
  end if
end sub

dan maak je het begin van n woord raad spel

ook hier : pas het path aan !!!

Code: Selecteer alles
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
global WinX , WinY , pi
pi = atn( 1 ) * 4
dim sx( 40 ) , sy( 40 )
WinX = WindowWidth
WinY = WindowHeight
for i = 0 to 25
  loadbmp "chr" + nr$( i , 2 ) _
  , "D:\BASIC_LIBERTY\BMP\chr" + nr$( i , 2 ) + ".bmp"
next i
nomainwin
global w$
w$ = "CHEMISTRY"
open "ANAGRAM" for graphics as #m
  #m "trapclose [quit]"
  for i = 1 to len( w$ )
    #m "addsprite q" + nr$( i , 2 ) _
    + " chr" + nr$( asc( mid$( w$ , i , 1 ) ) - asc( "A" ) , 2 )
    x = rnd( 0 ) * ( WinX - 64 )
    y = rnd( 0 ) * ( WinY - 64 )
    #m "spritexy q" + nr$( i , 2 ) ; " " ; x ; " " ; y
    h = rnd( 0 ) * pi * 2
    x = sin( h ) * 4
    y = cos( h ) * 4
    #m "spritemovexy q" + nr$( i , 2 ) ; " " ; x ; " " ; y
    sx( i ) = x
    sy( i ) = y
    #m "spritevisible q" + nr$( i , 2 ) ; " on"
  next i
  timer 40 , [tmr]
wait
[tmr]
  timer 0 , [tmr]
  for i = 1 to len( w$ )
    #m "spritexy? q" + nr$( i , 2 ) + " x y"
    if x < 0 then
      sx( i ) = abs( sx( i ) )
      #m "spritemovexy q" + nr$( i , 2 ) _
      + " " ; sx( i ) ; " " ; sy( i )
    end if
    if x > WinX - 64 then
      sx( i ) = 0 - abs( sx( i ) )
      #m "spritemovexy q" + nr$( i , 2 ) _
      + " " ; sx( i ) ; " " ; sy( i )
    end if
    if y < 0 then
      sy( i ) = abs( sy( i ) )
      #m "spritemovexy q" + nr$( i , 2 ) _
      + " " ; sx( i ) ; " " ; sy( i )
    end if
    if y > WinY - 64 then
      sy( i ) = 0 - abs( sy( i ) )
      #m "spritemovexy q" + nr$( i , 2 ) _
      + " " ; sx( i ) ; " " ; sy( i )
    end if
  next i
  #m "drawsprites"
  timer 40 , [tmr]
wait
function nr$( no , max )
  nr$ = right$( "00000000" + str$( no ) , max )
end function
[quit]
  close #m
end

nog nodig :
n bestant met woorden
kies n willekuering woord
n ik gok button
tijdbijhoud algoritme
punten telling
bluatigro
 
Berichten: 306
Geregistreerd: za sep 27, 2008 6:01 pm

Re: ANAGRAM

Berichtdoor Gordon » zo feb 28, 2010 6:28 pm

Het werkt hier,
maar waarom zet je de TIMER uit en dan weer aan?
Liberty BASIC kan het stukje listing toch wel in 40 milli seconden
afspelen?

Timer uit is:
Timer 0

Gordon
Avatar gebruiker
Gordon
Site Admin
 
Berichten: 684
Geregistreerd: zo mei 22, 2005 12:50 am


Keer terug naar OPEN SOURCE PROJECTEN

Wie is er online

Gebruikers op dit forum: Geen geregistreerde gebruikers. en 1 gast

cron