Показать сообщение отдельно
Старый 13.02.2009, 19:04   #3
Mark Castle
Знающий
 
Регистрация: 04.10.2008
Адрес: Киев
Сообщений: 230
Написано 3 полезных сообщений
(для 3 пользователей)
Ответ: Столкновения...

тоесть так?а то что то не работает...
Graphics3D 1024,768,32 
SetBuffer BackBuffer() 
Global user 
Global camera 
Const user_type = 1,stena_type = 2
Global pricel=LoadImage("D:\battle\prizel.bmp") 
Global shot_sprite=LoadSprite("D:\battle\vistrel.bmp")
                  Type shot 
                   Field entity 
	       Field dist# 
                   End Type
                        Function karta()
       	                robot = LoadMesh ("G:\Blitz3d\Media\geometricks_models\stealth\stealth.3ds")
PositionEntity robot,0,10,-50
ScaleEntity robot,0.1,0.1,0.1
stena = CreateCube()
EntityType stena,stena_type
Collisions user_type,stena_type,2,2
PositionEntity stena, 0,ground,100
ScaleEntity stena,2,5,5
texture = LoadTexture("D:\battle\k.jpg")
texture1 = LoadTexture("d:\battle\i.jpg")
EntityTexture stena,texture
For x = 1 To 100
razm = CopyEntity(stena)
PositionEntity razm, Rnd(-120, 120), 0, Rnd(1, 240)
Next 
	 	        End Function 
            Function create_Shot(x#,y#,z#,pitch#,yaw#,roll#) 
background = PlayMusic("D:\battle\str.wav")
            s.shot=New shot 
	s\entity=CopyEntity(shot_sprite) 
	PositionEntity s\entity,x#,y#,z#,1 
	RotateEntity s\entity,pitch#,yaw#,roll#,1 
     	Return True 
            End Function
     Function create_user(x#=0,y#=1,z#=0) 
     MidHandle pricel MaskImage pricel,255,255,255
     user=CreateSphere() 
     camera=CreateCamera(user) 
     PositionEntity camera,0,1,-0.5 
     PositionEntity user,x#,y#,z# 
EntityType user,user_type
     End Function 
           Function update_user()
	V#=0.2
	u#=70
	TurnEntity camera,MouseYSpeed(),0,0
	TurnEntity user,0,-MouseXSpeed(),0
	If KeyDown(30)=1 Then MoveEntity user,-V#,0,0
	If KeyDown(32)=1 Then MoveEntity user,V#,0,0
	If KeyDown(17)=1 Then MoveEntity user,0,0,+V# 
	If KeyDown(31)=1 Then MoveEntity user,0,0,-V#
	MoveMouse GraphicsWidth()*0.5,GraphicsHeight()*0.5
	If Abs(EntityPitch#(camera))>u# RotateEntity camera,u#*Sgn(EntityPitch#(camera)),0,0
	If MouseHit(1) create_shot(EntityX(user),EntityY(user),EntityZ(user),EntityPitch(camera),EntityYaw(user),0)
	TranslateEntity user,0,-G#,0
End Function

  Function create_world() 
  terrain=CreatePlane() 
  tertex=LoadTexture("D:\battle\parket.jpg") 
  ScaleTexture tertex,5,5
  EntityTexture terrain,tertex 
  FreeTexture tertex 
  create_user() 
karta()
  End Function 
Function update_shot()
	vs#=1
	max_dist#=1000
	For a.shot=Each shot
 MoveEntity a\entity,0,0,vs#
 a\dist#=a\dist#+vs#
 If a\dist#>max_dist#
 	FreeEntity a\entity
 	Delete a
 ElseIf EntityCollided(a\entity,TERRT) <> 0
 	FreeEntity a\entity
 	Delete a
 EndIf
	Next
	
End Function
                             create_world() 
                             While Not KeyHit(1)=1 
			update_user() 
		     update_shot()
                             RenderWorld() 
	                 DrawImage pricel,MouseX(),MouseY()
                            HideEntity shot_sprite

           		     Flip 
		     Wend 
                             End
(Offline)
 
Ответить с цитированием