#88325 - 2002-09-27 03:31 PM
KiXWeeper v1.3 - Kixtart in MAJOR!
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
code:
$name="KiXWeeper v1.3" $author="1.0 Shawn","1.1 Lonkero","1.2 Lonkero","1.3 Lonkero" $Form = CreateObject("Kixtart.Form") $Form.Caption = $name $Form.BackColor = 255,255,255 $Form.ForeColor = 50,0,170 $Form.FontName = "Courier New" $Form.FontBold = 1 $Form.FontSize = 10
$level=$form.slider(,15,12,75,25) $level.tooltip="Level: 0" $level.min=11 $level.onscroll="$$level.tooltip='Level: '+($$level.value-11)" $=11 for $height=390 to $form.screen.height step 25 $=$+1 next $level.max=$-1 ;<-if you remove this -1 you will get error every time! $thislevel=11
Global $Button[$,$], $mine $map=$Button $r=0 $b=0 For $Top = 50 To ($*25+25) Step 25 For $Left = 10 To ($*25-15) Step 25 $map[$r,$b] = $Form.label(,$left,$top,25,25) $map[$r,$b].hide $map[$r,$b].alignment=2 $map[$r,$b].FontSize=14 $map[$r,$b].BorderStyle=1 $Button[$r,$b] = $Form.button(,$left,$top,25,25) $Button[$r,$b].hide $Button[$r,$b].FontBold = 1 $Button[$r,$b].onclick="button_click($r,$b)" $b=$b+1 Next $b=0 $r=$r+1 Next
$Time = $Form.Label $Time.Size = 75,30 $Time.Alignment = 1 $Time.BorderStyle = 4 $Time.Fontname = "Courier New" $Time.Fontsize = 14 $Time.Fontbold = 1 $Time.BackColor = 0 $Time.ForeColor = 255,255,0
$start=$form.button("New Game",225,10,75,25) $start.onclick="new($$level.value)"
new(11) $Form.Show
While $Form.Visible $=Execute($Form.DoEvents) Loop
Exit 1
Function Button_Click($r,$b) $=$thislevel select case not $Button[$r,$b].visible case " "=$map[$r,$b].caption $Button[$r,$b].Hide $Score=$Score+1 $Button[$r,$b].hide if $b>0 and $r>0 button_click($r-1,$b-1) endif if $r>0 button_click($r-1,$b) endif if $b<$ and $r>0 button_click($r-1,$b+1) endif if $b>0 button_click($r,$b-1) endif if $b<$ button_click($r,$b+1) endif if $b>0 and $r<$ button_click($r+1,$b-1) endif if $r<$ button_click($r+1,$b) endif if $b<$ and $r<$ button_click($r+1,$b+1) endif case instr($map[$r,$b].caption,"X") $map[$r,$b].forecolor=255,0,0 $Button[$r,$b].Hide $map[$r,$b].show for $r=0 to $ for $b=0 to $ if $button[$r,$b].visible $Button[$r,$b].caption=$map[$r,$b].caption $Button[$r,$b].enabled=0 endif next next $timer=0 case 1 $map[$r,$b].forecolor=50,0,170 $Button[$r,$b].Hide $Score=$Score+1 endselect $map[$r,$b].show if $Score = ($+1)*($+1)-($+1)*($+1)/10 $timer=0 $=messagebox("GOOD! You made your way trough the mine fields!",$name) endif if $timer and $timer<>0 $timer=$Form.timer(1000) $timer.ontimer="$$time.caption=1+val($$time.caption)" endif EndFunction
function new($size) $score=0 $thislevel=$size $timer=1 $Time.Caption = 0 $mine=" ," srnd(@ticks) do $=rnd(($size+1)*($size+1)) if not instr($mine,$) $mine="$mine ,"+$ endif until (($size+1)*($size+1)/10+1)<ubound(split($mine," ,"))
for $r=0 to $level.max for $b=0 to $level.max if $b>$size or $r>$size $Button[$r,$b].hide else $Button[$r,$b].caption="" $Button[$r,$b].enabled=1 $Button[$r,$b].show endif $map[$r,$b].hide $map[$r,$b].caption="" next next
$Form.Width = $size*25+50 $Form.Height = $size*25+115 $Form.Center $Time.Center $Time.Top = 10 $start.left=$form.width-95
$c=1 for $r=0 to $size for $b=0 to $size if instr($mine,",$c ,") $map[$r,$b].caption="X" endif $c=$c+1 next next
for $r=0 to $size for $b=0 to $size if not instr($map[$r,$b].caption,"X") $=0 if $b>0 and $r>0 if instr($map[$r-1,$b-1].caption,"X") $=$+1 endif endif if $r>0 if instr($map[$r-1,$b].caption,"X") $=$+1 endif endif if $b<$size and $r>0 if instr($map[$r-1,$b+1].caption,"X") $=$+1 endif endif if $b>0 if instr($map[$r,$b-1].caption,"X") $=$+1 endif endif if $b<$size if instr($map[$r,$b+1].caption,"X") $=$+1 endif endif if $b>0 and $r<$size if instr($map[$r+1,$b-1].caption,"X") $=$+1 endif endif if $r<$size if instr($map[$r+1,$b].caption,"X") $=$+1 endif endif if $b<$size and $r<$size if instr($map[$r+1,$b+1].caption,"X") $=$+1 endif endif if $=0 $map[$r,$b].caption=" " else $map[$r,$b].caption=$ endif endif next next endfunction
[ 29. October 2002, 10:28: Message edited by: Lonkero ]
_________________________
!download KiXnet
|
|
Top
|
|
|
|
#88336 - 2002-09-30 03:40 PM
Re: KiXWeeper v1.3 - Kixtart in MAJOR!
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
that is really . I will have to dig through the code next weekend so that I can learn something new.
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
1 registered
(Allen)
and 1172 anonymous users online.
|
|
|