Показать сообщение отдельно
Старый 17.07.2010, 20:59   #7
nikerban
Нуждающийся
 
Регистрация: 15.07.2010
Сообщений: 57
Написано 2 полезных сообщений
(для 2 пользователей)
Ответ: как сделать прикрепление оружия в камере

.game
gx=640 gy=480
px=gx/2:py=gy/2
Graphics3D gx,gy,16,1
SetBuffer BackBuffer()
HidePointer
LoadWeapon()
Setup()
Global pricel
Global weapon
Function Setup()
pricel=LoadImage("textures\cross.png")
MidHandle pricel
MaskImage pricel,255,255,255
End Function
FreeSound music
zombie=LoadAnimMesh("mesh/officer.b3d")
PositionEntity zombie,3,0,0
ScaleEntity zombie,0.1,0.1,0.1
EntityType zombie,2
Function LoadWeapon()
weapon = LoadAnimMesh("mesh\MP5.B3D")
texweapon=LoadTexture("textures/MYMP5.bmp")
EntityType weapon,2
EntityTexture weapon,texweapon
ExtractAnimSeq(weapon,1,1 )
ExtractAnimSeq(weapon,2,8 )
Animate weapon, 1, 0.8, 1
EntityPickMode weapon, 2
PositionEntity weapon,0,-12,0
RotateEntity weapon,0,90,0
EntityParent weapon,cam
EntityRadius weapon,1
EntityOrder weapon,-1
End Function
jumpert=LoadAnimSeq(zombie,"animation/die_spin.smd.")
meshtex=LoadTexture("textures/Zombie.jpg")
EntityTexture zombie,meshtex
fonovoy=LoadSound("audio/ligalayz-stress.mp3")
PlaySound fonovoy
zdorov=100
canister=LoadMesh("mesh/canister.x")
PositionEntity canister,-5,0,15
ScaleEntity canister,0.3,0.3,0.3
EntityRadius canister,2
EntityType canister,typecanister
canistertex=LoadTexture("mesh/bluecanister_D2.dds")
EntityTexture canister,canistertex
EntityType canister,2
muscat=False
planes$=CreateSphere()
ScaleEntity planes$,1000,1000,1000
PositionEntity planes$,0,0,0
EntityType planes$,2
sky=LoadTexture("textures/sky.jpg")
EntityTexture planes,sky
FlipMesh planes$
misc=False
cool$=LoadSound("audio/step.wav")
cam=CreateCamera()
EntityRadius cam,2
CameraRange cam,1,10000
PositionEntity cam,0,2,0
EntityType cam,1
light=CreateLight()
plane=CreatePlane()
tex=LoadTexture("textures/grass.jpg")
EntityTexture plane,tex
EntityType plane,2
Collisions 1,2,2,3
bam=LoadSound("audio/bam.wav")
baam=0
Repeat
dist=dist+1
If EntityCollided(canister,type2) zdorov=zdorov-1
If zdorov>1
Else
End
EndIf
If baam=1 Then PlaySound bam
If MouseDown(1) Then baam=Rand(1,10)
If KeyDown(200) Then Animate zombie,5,0.1,jumpert
jumpak$=Rand(1,10000)
jumper$=Rand(0.5,1)
If KeyDown(17) Then misc=Rnd(1,50)
jump$=Rand(1,10)
If jump$=5 MoveEntity cam,0,-100,0
If KeyDown(1) Then Goto menu
If KeyDown(17) And KeyDown(42) Then MoveEntity cam,0,0,0.2
If KeyDown(17) And KeyDown(42) Then muscat=Rnd(1,20)
If KeyDown(17) MoveEntity cam,0,0,0.1
If misc=43 Then PlaySound cool$
If muscat=15 Then PlaySound cool$
If KeyDown(31) And KeyDown(42) Then MoveEntity cam,0,0,-0.2
If KeyDown(31) And KeyDown(42) Then muscat=Rnd(1,20)
If KeyDown(31) Then MoveEntity cam,0,0,-0.1
If KeyDown(31) Then misc=Rnd(1,50)
If KeyDown(32) MoveEntity cam,0.2,0,0
If KeyDown(30) MoveEntity cam,-0.2,0,0
If KeyDown(57) MoveEntity cam,0,jumper$,0
mxspd#=MouseXSpeed()*0.25
MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
campitch#=EntityPitch(cam)+myspd#
If campitch#<-85 Then campitch#=-85
If campitch#>85 Then campitch#=85
RotateEntity cam,campitch#,EntityYaw(cam)-mxspd#,EntityRoll(cam)
MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
campitch#=EntityPitch(weapon)+myspd#
If campitch#<-85 Then campitch#=-85
If campitch#>85 Then campitch#=85
RotateEntity weapon,campitch#,EntityYaw(weapon)-mxspd#,EntityRoll(weapon)
UpdateWorld()
RenderWorld()
DrawImage pricel,px,py
Text 10,10,"Health="+zdorov
Flip
Until KeyHit(2)
End
(Offline)
 
Ответить с цитированием