KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

KiXlander - Reloaded

 
Post new topic   Reply to topic    KiXforms Forum Index -> Fun & Games
View previous topic :: View next topic  
Author Message
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Fri Jul 30, 2004 11:45 am    Post subject: KiXlander - Reloaded Reply with quote

Remember Shawn's excellent Lander port ?

It refuses to play correctly for quite a while now. Ok, I dug that up and restaurated it a bit.

For those who haven't saved the game and it's sound files etc. you may request it zip'd at jochenDOTpolsterATgmxDOTnet Wink

for those who have saved it here is the source :

Code:
break on

$ = Setconsole("Hide")
;
; KiXlander
;
; Requires:
; KIXTART 4.02
; KIXFORMS BUILD 7
;
; This is a port of a Public Domain Visual Basic
; Lander program - with mods by yours truely.
;
; Use the enter to start your decent. Use the up-arrow
; key to apply thrust. When done, use the enter to reset
; the lander and again, to start you decent.
;
; -Shawn

; This very version was lovingly restaurated by yours truly
; it should play with alpha build 45 and above
;
; -Jochen


srnd(-1*@ticks) ; Randomize


$SOUNDS      = 1 ; set to zero to turn sounds off


$SCRIPT      = "KiXlander"
$VERSION   = "1.7"
$AUTHOR    = "-Shawn"
$CAPTION   = "$SCRIPT v$VERSION"
;
; Resources
;
$BACKGND    = @scriptdir+"\backgnd.bmp"
$CLOUD       = @scriptdir+"\cloud.bmp"
$LANDER    = @scriptdir+"\lander.bmp"
$CRASH      = @scriptdir+"\crash.bmp"
$BOOM       = @scriptdir+"\boom2.wav"
$LANDED      = @scriptdir+"\landed.wav"
$soundlib =
"boom.wav",
"problem.wav",
"notgood.wav",
"safe.wav",
"dstruct1.wav",
"kaboom.wav",
"fading.wav",
"100safe.wav",
"lsngwarp.wav",
"dontfail.wav",
"whatjunk.wav",
"averted.wav",
"letshope.wav",
"wndofail.wav",
"drawing.wav",
"engrfeat.wav",
"idontlik.wav",
"short.wav",
"boom4.wav",
"crash.wav",
"crash4.wav",
"down.wav"


$WHITE       = &0FFFFFF
$BLACK      = &0
$GREEN      = &000FF00
$YELLOW      = &0AAFFFF

;
; Settings
;

$MAXFUEL = 1000

;
; Setup the form
;

$Form              = CreateObject("Kixtart.Form")
$Form.Picture      = $CLOUD
$Form.BorderStyle    = 1
$Form.MinButton      = 1
$Form.MaxButton      = 0
$Form.Caption       = $CAPTION
$Form.ClientWidth    = 475
$Form.ClientHeight    = 585
$Form.ForeColor    = $WHITE


$txtFuel          = $Form.Textbox
$txtFuel.Left       = 352
$txtFuel.Top       = 25
$txtFuel.Width      = 113
$txtFuel.Height      = 25
$txtFuel.Text      = $MAXFUEL
$txtFuel.FontName   = "Courier New"
$txtFuel.FontSize    = 12
$txtFuel.FontWeight = 600
$txtFuel.BackColor    = $BLACK
$txtFuel.ForeColor    = $GREEN


$txtSpeed           = $Form.Textbox
$txtSpeed.Left       = 352
$txtSpeed.Top       = 75
$txtSpeed.Width    = 113
$txtSpeed.Height    = 25
$txtSpeed.Text       = "0"
$txtSpeed.FontName    = "Courier New"
$txtSpeed.FontSize    = 12
$txtSpeed.FontWeight    = 600
$txtSpeed.BackColor    = $BLACK
$txtSpeed.ForeColor    = $GREEN


$txtHeight           = $Form.Textbox
$txtHeight.Left    = 352
$txtHeight.Top       = 125
$txtHeight.Width    = 113
$txtHeight.Height    = 25
$txtHeight.Text    = "500.0"
$txtHeight.FontName    = "Courier New"
$txtHeight.FontSize    = 12
$txtHeight.FontWeight    = 600
$txtHeight.BackColor    = $BLACK
$txtHeight.ForeColor    = $GREEN


$picEarth           = $Form.PictureBox
$picEarth.Picture    = "$BACKGND"
$picEarth.Left       = 8
$picEarth.Top       = 8
$picEarth.Width    = 332
$picEarth.Height    = 564
$picEarth.BorderStyle = 2


$imgLander           = $picEarth.Image
$imgLander.Picture   = $LANDER
$imgLander.Left    = ($picEarth.ScaleWidth-$imgLander.Width)/2


$cmdStart           = $Form.CommandButton
$cmdStart.Left      = 352
$cmdStart.Top       = 160
$cmdStart.Width    = 115
$cmdStart.Height    = 25
$cmdStart.Caption    = "Start"
$cmdStart.FontName    = "MS Sans Serif"
$cmdStart.FontSize    = 12
$cmdStart.FontBold    = 1
$cmdStart.Default   = 1
$cmdStart.OnClick    = "cmdStart_Click"


$Form.FontSize   = 10
$Form.ForeColor   = $YELLOW
$Form.PrintXY(352,10,"Fuel:")
$Form.PrintXY(352,60,"Speed:")
$Form.PrintXY(352,110,"Altitude:")


$Form.FontSize   = 8
$Form.ForeColor   = $Form.RGB(255,255,0)
$Form.PrintXY(360,490,"Powered by:")
$Form.PrintXY(360,505,"KiXtart v@KIX")
$Form.PrintXY(360,520,"Kixforms Build " + $form.Build)
$Form.PrintXY(360,535,"Author: Shawn")


$Fuel = $MAXFUEL
$txtFuel.text = $fuel
$MaxX = $picEarth.ScaleWidth
$MaxY = $picEarth.ScaleHeight
$Speed = 0


$Form.Center


$Instructions = "
Press the ENTER key to start your decent. Use
the UP-ARROW to apply thrust. When done, reset
the game with the ENTER key.

-Shawn
"


$Form.MsgBox($Instructions,$CAPTION)


$Form.Show
$Form.SetFocus
while $Form.Visible
 $=Execute($Form.DoEvents)
Loop


Exit 1


Function cmdStart_Click()


 $cmdStart.Enabled = 0
 $cmdStart.Default = 0
 $Timer = 0


 ; Start an Asynchronous event loop
 ; This is done with DoEvents(1) [nowait]


 While $Form.Visible


  $=Execute($Form.DoEvents(1))


  If @Ticks > $Timer


   ; Gravity timer returns 1 if
   ; we've crashed - reset the game


   If Gravity_Timer() = 1


    $cmdStart.Text = "Reset"
    $cmdStart.OnClick = "cmdReset_click"
    $cmdStart.Default = 1
    $cmdStart.Enabled = 1
    Return


   EndIf


   ; Ensure we wait at least 1 msec
   ; before the next timer fires.


   $Timer = @TICKS + 1


  Endif


 Loop


EndFunction

Function Gravity_Timer()


 ; Not using timediff at this time
 ; But the timediff can be factored
 ; into the equation if desired, eg:
 ; $Speed = $Speed + $TimeDiff / 10


 If $TimeNow = 0 ; first time ?


  $TimeNow = @TICKS
  $CurTime = $TimeNow


 Else


  $TimeNow = @TICKS
  $TimeDiff = $TimeNow - $CurTime


  $Speed = $Speed + 1


  ; Check if up-arrow pressed and if we have enough
  ; fuel to thrust ...


  If $Form.KeyState(&26) and $Fuel > 0
   $Speed = $Speed - 2
   $Fuel = $Fuel - 5
   $txtFuel.Text = $Fuel
   $Thrust = 0
  EndIf


  $Delta = $Speed / 6


  ; Check if we're near the ground ...


  If $imgLander.Top + $Delta > 490

   $imgLander.Top = 490
   $txtHeight.Text = 0
   $txtSpeed.Text = $Speed


   ; Have we crashed ...


   If $Speed > 9


    $imgLander.Picture = "$CRASH"


    If $Sounds
     $Fun=$fun+1
     If $Fun = 4 or RND(4) = 2
      $Sound = @scriptdir + "\" + $SoundLib[RND(UBound($SoundLib))]
      Play $Sound
      $Fun=0
     Else
      Play "$BOOM"
     Endif
    EndIf

    $Form.SetFocus

   Else


    ; We've landed ok ...


    If $sounds
     Play "$LANDED"
    EndIf

    $Form.SetFocus

   EndIf


   $Gravity_Timer = 1 ; Flag to reset


   Return


  Endif


  ; Move the ship

  $imgLander.Top = $imgLander.Top + $Delta
  $txtHeight.text = 500 - $imgLander.Top
  $txtSpeed.Text = $Speed


  $curTime = $TimeNow


 EndIf


EndFunction


Function cmdReset_Click()


 ; Reset the game


 $TimeNow = 0
 $Timer = 0
 $Speed = 0
 $txtSpeed.Text = 0
 $Fuel = $MAXFUEL
 $txtFuel.Text = $Fuel
 $imgLander.Top = 0
 $txtHeight.Text = 500
 $imgLander.Picture = "$LANDER"
 $cmdStart.OnClick = "cmdStart_click"
 $cmdStart.Caption = "Start"


EndFunction

_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Fun & Games All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group