Teach Me to

Blitz3D Forums/Blitz3D Programming/Teach Me to

seferey(Posted 2006) [#1]
Please teach me to run content from a .zip file in blitz3d

:)


seferey(Posted 2006) [#2]
what type of command would I use to run content from a zip file


poopla(Posted 2006) [#3]
The type of command would be the kind that extracts data from a zip file.

Look in the archives, I think there's something(s) there for this.


seferey(Posted 2006) [#4]
is it read file opend file read short


octothorpe(Posted 2006) [#5]
yes but probably read byte instead


seferey(Posted 2006) [#6]
Here's the Code

; Open the file to Read
filein = ReadFile("mydata.dat")

Read1 = ReadByte( filein )
Read2 = ReadByte( filein )
Read3 = ReadByte( filein )
Read4 = ReadByte( filein )
Read5 = ReadByte( filein )
Read6 = ReadByte( filein )
Read7 = ReadByte( filein )
Read8 = ReadByte( filein )

; Close the file once reading is finished
CloseFile( fileout )


I'm trying to read content from a zip file within a folder and do I leave filein alone or do I write something in it

also Do I half to change something in this code to get it to work

;Name of application
AppTitle "My First Terrain And First animated Character"

Print "Press F12 to exit"
Print "Press F11 to see Wireframe Mode."
Print "After the wheels start moving"
Print "Press Spacebar to move the car."

Delay 3000

;Initialise Graphics mode
Graphics3D 800,600,16,1

SetBuffer BackBuffer()

Const GRAVITY#=-0.01

;Camera has to be set, so the scene is visible
  
Camera=CreateCamera()
CameraRange Camera,1,8000 
;CameraFogMode camera,1
;CameraFogColor camera,1,150,150
;CameraFogColor camera,20,23,150
PositionEntity camera,30,0,1,True
 
;Light The Scene, so that it doesn't look flat

Light=CreateLight()

RotateEntity Light,90,0,0

Create the "Terrain" Entity...
terrain=LoadMesh("Land\land2.b3d")
PositionEntity terrain,40,17,0
RotateEntity terrain,0,0,0 
TranslateEntity terrain,40,-20,-.1 
;...and texture it
Grass=LoadTexture("Land\terrain-1.jpg")
EntityTexture terrain,Grass

;Create A Border Line 

Wall=CreateCube() 
ScaleMesh Wall,600,600,600
PositionMesh Wall,60,17,0 
EntityAlpha Wall,0
EntityOrder Wall,20
FlipMesh Wall

;Create a skybox using a model sphere

Sky1=CreateSphere(32)
ScaleMesh Sky1,5000,5000,5000
PositionEntity Sky1,30,-.9000,0 
Sky=LoadTexture("Sky\sky.bmp") 
EntityTexture Sky1,Sky
EntityFX Sky1,1
EntityOrder Sky1,20
FlipMesh Sky1

;FOG_RANGE=400

;Create the "Box" entity and animate it
box=LoadAnimMesh("model\box.b3d")
ScaleEntity box,.1,.1,.1
PositionEntity box,0,-.9000,5
TranslateEntity box,30,-.70,-.70
EntityShininess box,1
SetAnimKey box,15,True,True,True
AddAnimSeq(box,15)
Animate box,1,2,0,100

;Set Collision types fot the "collisions" command 1-player, 2-ground 3-border
type_box=1
type_terrain=2
type_Wall=2
EntityType box,1
EntityType terrain,2
EntityType Wall,2


;Adjust Radius of Sphere, that's used for Sphere-Polygon collisions
box_radius#=1
EntityRadius box,box_radius
;Initialise Collisions between player,ground and border

Collisions type_box,type_terrain,2,3 
Collisions type_terrain,type_box,2,3
Collisions type_Wall,type_terrain,2,3 
Collisions type_terrain,type_Wall,2,3

;Dither scene, so that it does look good with 16 Bit Color-Depth


; Toggle dither enable value between true and false when F10 is pressed


If KeyHit( 68 )=True Then enable=1-enable

Dither enable 

;other information about gravity

speed#=0
x_vel#=0:prev_x#=EntityX( box )
y_vel#=0:prev_y#=EntityY( box )
z_vel#=0:prev_z#=EntityZ( box )

;Main Loop

While Not KeyHit(88) ;press F12 To Exit

;Press F11 to see the world in Wireframe mode

 
If KeyHit(87)=True Then enable=1-enable 
  
   WireFrame enable 

;CameraFogRange camera,1,FOG_RANGE

   ;calculate box velocities	
	cx#=EntityX( box ):x_vel=cx-prev_x:prev_x=cx
	cy#=EntityY( box ):y_vel=cy-prev_y:prev_y=cy
	cz#=EntityZ( box ):z_vel=cz-prev_z:prev_z=cz

EntityParent(camera,box,1)  

;Keyboard Input (cursor-keys) For moving the player around
    
If KeyHit(57) 
  If move_entities = True 
    move_entities = False 
  Else 
    move_entities = True   
  EndIf 
EndIf 

If move_entities = False 
  
  ;all of your movement code
  If KeyDown(30) TurnEntity box,0,1,0 
  If KeyDown(32) TurnEntity box,0,-1,0 
  If KeyDown(31) MoveEntity box,0,0,-.01 
  If KeyDown(17) MoveEntity box,0,0,.01 
  If EntityCollided( box,terrain)  
    If KeyDown(17) 
      speed=speed+.00 
      If speed>.0 speed=.0 
    Else If KeyDown(31)
      speed=speed-.02
      If speed<-.5 speed=-.5
    Else
      speed=speed*.9
    EndIf
    MoveEntity box,0,0,speed
    TranslateEntity box,0,GRAVITY#-.01,0
  Else
    TranslateEntity box,x_vel,y_vel+GRAVITY,z_vel
  EndIf
EndIf

TurnEntity Sky1,0,.02,0 

PositionEntity Sky1,EntityX(camera),EntityY(camera),EntityZ(camera)

;Update the animation-Frames and Render the calculated scene, Flip Back- with Frontbuffer after that, so the new frame becomes visible
  UpdateWorld
  RenderWorld
  Flip  

Wend

;Free the Memory and end the program
ClearWorld

End



octothorpe(Posted 2006) [#7]
http://blitzbasic.com/Community/topics.php?forum=5


seferey(Posted 2006) [#8]
well that didn't help much???

:(


Sledge(Posted 2006) [#9]
How about this?


seferey(Posted 2006) [#10]
Well I figured out the readfile readshort and writeshort a
little.