Тема: Порталы
Показать сообщение отдельно
Старый 20.02.2011, 05:31   #22
RegIon
Элита
 
Аватар для RegIon
 
Регистрация: 16.01.2010
Адрес: Новосибирск
Сообщений: 2,158
Написано 502 полезных сообщений
(для 1,012 пользователей)
Ответ: Порталы

Global newvalue#,oldvalue#,increments,mx#,my#,camera,hero,pitch#,yaw#,cameraX#,cameraY#,cameraZ#,cx#,cz#
Global mousespeed#=.2,cameraspeed#=.5,camerasmoothness#=3

Global hero_energy%=1000


hero_t=1:col_T=2
Graphics3D 1024,768
SetBuffer BackBuffer()

camera=CreateCamera()

light=CreateLight()
RotateEntity light,90,0,0



poligon=LoadMesh("datas\mesh\test.3ds")
Poligon_plan=CreatePlane()
PositionEntity poligon_plan,0,-.005,0
EntityColor poligon_plan,0,0,0
EntityType poligon,Col_t
EntityType poligon_plan,col_t

createhero(camera,0,10,0)

CameraFogMode camera,0 
CameraFogRange camera,1,110
CameraFogColor camera,0,0,0


MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
Collisions hero_t,col_t,2,3
Repeat 

upr_mouse#()


	UpdateWorld()
	RenderWorld()

	Flip
Until KeyHit(1) 
End


Function CurveValue#(newvalue#,oldvalue#,increments )
If increments>1 oldvalue#=oldvalue#-(oldvalue#-newvalue#)/increments
If increments<=1 oldvalue=newvalue
Return oldvalue#
End Function

Function createhero(camera%,x%,y%,Z%)
EntityRadius camera,2,1
HEro=CreateSphere()
EntityRadius hero,2,1
EntityAlpha hero,0
CameraRange camera,1,10000
ScaleEntity camera,.5,.5,.5
RotateEntity camera,45,0,0
PositionEntity camera,x,y,z
PositionEntity hero,x,y,z
EntityType camera,hero_t
EntityType hero,hero_t
End Function 
	
Function upr_mouse#()
	mx#=CurveValue(MouseXSpeed()*mousespeed#,mx#,camerasmoothness#)
	my#=CurveValue(MouseYSpeed()*mousespeed#,my#,camerasmoothness#)
	MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
	pitch#=EntityPitch(camera)
	yaw#=EntityYaw(camera)
	pitch#=pitch#+my#
	yaw#=yaw#-mx#
	If pitch#>79 pitch#=79
	If pitch#<-69 pitch#=-69
	RotateEntity camera,0,yaw#,0
	RotateEntity hero,0,yaw#,0
	TurnEntity camera,pitch#,0,0
	cx#=(KeyDown(32)-KeyDown(30))*cameraspeed#
	cz#=(KeyDown(17)-KeyDown(31))*cameraspeed#
	cameraX#=EntityX#(hero)
	cameraY#=EntityY#(hero)
	cameraZ#=EntityZ#(hero)
	MoveEntity hero,cx#,0,cz#
	PositionEntity camera,cameraX#,cameraY#+8,cameraZ#
	RotateEntity hero,60,yaw#,0
	TranslateEntity hero,0,-.3,0
	End Function
Проваливается....хоть здохни.
__________________
Сайт: http://iexpo.ml
(Offline)
 
Ответить с цитированием