Public feed #380253

Miscellany

public text v1 · immutable
Raw Edit
·published 2007-03-03 22:22 UTC
rendered paste body
REM Project: own
REM Created: 3/3/2007 10:18:18 AM
REM Created by Blah569
REM ***** Main Source File *****
REM

rem Presets
sync on:sync rate 100:hide mouse
backdrop on
set camera range 1,3000
Fog on
Fog distance 3000
Fog color rgb(128,128,128)
color backdrop rgb(128,128,128)
rem particals
Pn=10
MPn=110

enemyhp# = 5
ammo# = 250
clips# = 25
health# = 100
room# = 0


rem load stuff for game

Load image "grass09.bmp",1
load image "wall_m_23.jpg",2
load image "wall_m_16.jpg",3
load image "fire.bmp",222

Rem grass
Make matrix 1,10000,10000,20,20
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1

rem make ze weapon
Make object cylinder 111,2
XRotate Object 111,90
Fix object pivot 111
Scale object 111,100,100,500
position object 111,0,-7,15
Lock object on 111

rem bullet
Make Object Sphere 222,3
texture object 222,222
Hide Object 222

rem Objects
rem player
make object sphere 1,40:color object 1, rgb(100,100,100):hide object 1
rem Level structure
make object box 2,300,100,4:position object 2,4,4,4:texture object 2,3
make object box 3,300,100,4:position object 3,304,4,4:texture object 3,3


do

rem hud
text 0,0, "Health: "+str$(health#)
text 100,0,"Ammo: "+str$(ammo#)+"/"+str$(clips#)
fps = screen fps()
if controlkey()=1
text 200,0,"FPS: "+str$(fps)
endif


rem mouse camera movemnet
Camy#=Camy#+MOUSEMOVEX()*.1

Camx#=Camx#+MOUSEMOVEY()*.1
IF Camx#>90 AND Camx#<135 THEN Camx#=90

IF Camx#>270 AND Camx#<225 THEN Camx#=90

YROTATE CAMERA Camy#

XROTATE CAMERA Camx#

YROTATE OBJECT 1,Camy#

XROTATE OBJECT 1,Camx#


X#=OBJECT POSITION X(1)

Y#=OBJECT POSITION Y(1)

Z#=OBJECT POSITION Z(1)

rem camera position lol

POSITION CAMERA X#,Y#,Z#

IF KEYSTATE(17)=1
XAngle#=OBJECT ANGLE X(1)
XROTATE OBJECT 1,0
MOVE OBJECT 1,4
XROTATE OBJECT 1,XAngle#
ENDIF

IF KEYSTATE(31)=1
XAngle#=OBJECT ANGLE X(1)
XROTATE OBJECT 1,0
MOVE OBJECT 1,-4
XROTATE OBJECT 1,XAngle#
ENDIF

IF KEYSTATE(30)=1 THEN MOVE OBJECT LEFT 1,4

IF KEYSTATE(32)=1 THEN MOVE OBJECT RIGHT 1,4

IF Jump=1

Jump_Speed#=1

Jumping=1

Jump=0

ENDIF

`Jumping

IF Jumping=1

DEC Jump_Speed#,.001

POSITION OBJECT 1,X#,Y#+Jump_Speed#, Z#

ENDIF

rem shooting
if Mouseclick()=1 and Explode =0
      if BulletLife=0 or BulletLife<50
         Position object 222,X#,Y#-7,Z#
         Set object to camera orientation 222
         BulletLife =120
         show object 222
      Endif
   Endif
   If BulletLife > 0 then Gosub ShootBullet


sync
loop

Function DecoCollide(X#,Y#,Z#)

   for u = 1 to 9
      for v = 1 to 9
         if X#>u*1000-60
            if X#<u*1000+60
               if Z#>v*1000-60
                  if Z#<v*1000+60
                     if Y# < Get ground height(1,u*1000,v*1000)+575
                        Collide=1
                        Exitfunction Collide
                     endif
                  endif
               endif
            endif
         endif
      next v
   next u
   Collide=0

Endfunction Collide

Rem Shoot player bullet
ShootBullet:
      Dec BulletLife
      Move object 2,12

      bX#=Object position X(2)
      bY#=Object position Y(2)
      bZ#=Object position Z(2)

      inc Pn
      if Pn=21 then Pn=10
      remstart
      Scale object Pn,100,100,100
      Position object Pn,bX#,bY#,bZ#
      point object Pn,X#,Y#,Z#
      Zrotate object Pn,rnd(180)
      Show object Pn
      for x = 1 to 10
      rem scale object int((Wrapvalue((Pn-9+x)*36))/36)+10,100+x*25,100+x*25,100+x*25
      remend
      set cursor 10,10
      rem next x

      if bY# < Get Ground height(1,bX#,bZ#) then BulletLife=0
      set cursor 10,10
      if Sqrt((mX# - bX#)^2 + (mY#+25 - bY#)^2 + (mZ# - bZ#)^2) <20
         Rem Gosub PlaceMonst
         inc PlayerScore
         MonsterBulletLife =0
if       BulletLife=0
      endif

      if DecoCollide(bX#,bY#,bZ#) = 1 then BulletLife = 0

      if BulletLife = 0
         Hide object 2
         stop sound 2
         for x=10 to 20
            hide object x
         next x
         Explode = 20
         endif
         endif
         return