Показать сообщение отдельно
Старый 13.09.2007, 22:56   #5
jimon
 
Сообщений: n/a
Re: Функция стрельбы

Graphics3D 1024,768,32,1
SetBuffer BackBuffer()

Const typeplayer=1,Typepln=2

Global pulya

lit=CreateLight()

;--- надо player тогда как глобальную обьявить
Global player=CreatePivot()
PositionEntity player,0,10,0
EntityRadius player,.9
EntityType player,Typeplayer

camera=CreateCamera( player )
TranslateEntity camera,0,0.9,0
CameraRange camera,.1,200


pln=CreatePlane()
tex=LoadTexture("111.jpg")
ScaleTexture tex,5,5
EntityTexture pln,tex
EntityType pln,Typepln

;-------------
Function createpulya()
pulya=CreateSphere()
End Function

Function updatepulya()
if pulya = null then return
MoveEntity pulya,0,0,10
If EntityDistance(pulya,player) > 100 then
FreeEntity pulya
pulya = null
End Function
;-------------



Collisions typeplayer,Typepln,2,2

Repeat

;Параметр ускорения 
sp#=.05
shoe_size#=7.0 
head_bang_X#=0.1 
head_bang_Y#=0.1

;Система навигации мыши
mxs#=MouseXSpeed()/4.0
mys#=MouseYSpeed()/4.0
MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
camxa#=camxa-mxs Mod 360
camya#=camya+mys
If camya<-90 Then camya=-90
If camya>90 Then camya=90
RotateEntity player,0,camxa,0
RotateEntity camera,camya,0,0
;Перемещение игрока
MoveEntity player,0,-.05,0 
walking=0
If KeyDown(203) Then: MoveEntity player,-sp,0,0 : walking=1: EndIf
If KeyDown(205) Then: MoveEntity player, sp,0,0 : walking=1: EndIf
If KeyDown(200) Then: MoveEntity player,0,0, sp : walking=1: EndIf
If KeyDown(208) Then: MoveEntity player,0,0,-sp : walking=1: EndIf

If walking=1
a1#=(a1#+shoe_size) Mod 360
Else
EndIf
PositionEntity camera,Cos(a1#)*head_bang_X#,Sin(90+a1#*2)*head_ba ng_Y#,0,0

;-------------
If MouseDown(1) Then createpulya()
updatepulya()
;-------------

UpdateWorld

RenderWorld 
Flip

Until KeyHit(1)

End
смотри, я выделил изменения
 
Ответить с цитированием