Четверг, 25 Апреля 2024, 02:21

Приветствую Вас Гость

[ Новые сообщения · Игроделы · Правила · Поиск ]
  • Страница 1 из 1
  • 1
Форум игроделов » Программирование » Basic » Мне нужна ваша помощь. Я хочу создать монстра на blitz basic (Монстр на Blitz Basic3d)
Мне нужна ваша помощь. Я хочу создать монстра на blitz basic
sanya9411Дата: Вторник, 25 Октября 2011, 12:56 | Сообщение # 1
частый гость
Сейчас нет на сайте
# hunger has steady decay
hunger = hunger - 0.8 * seconds
if (hunger > 100) hunger = 100 endif
if (hunger < 0) hunger = 0 endif

# decrement energy when moving
energy = energy - 0.03*speed^2.2

# charge energy when still, except when hunger is red
if (speed < 0.01)
if (hunger >=0 and hunger <= 33) energy = energy -0.3 endif
if (hunger > 33 and hunger <= 66) energy = energy + 0.8 endif
if (hunger > 66 and hunger <= 100) energy = energy + 1.2 endif
endif

if (energy < 0) energy = 0 endif
if (energy > 100) energy = 100 endif

# creatures can starve to death
if (hunger >=0 and hunger <= 33) health = health -0.5 endif
if (health < 0) health = 0 endif
if (health > 100) health = 100 endif
Это будет образец...

Добавлено (25.10.2011, 12:56)
---------------------------------------------
;создаём окно в 3d мир
Graphics3D 640,480,32,2
;выбираем буфер прорисовки
SetBuffer BackBuffer()
;создаём камеру
cam=CreateCamera()
;размещаем камеру
PositionEntity cam,1,1,1
;создаём источник света
light=CreateLight()
AmbientLight 200,200,200
;размещаем его
RotateEntity light,90,0,0
PositionEntity light, 1,20,1
;создадим остров
terrain=LoadTerrain( "остров1.bmp" )
;установим детальность ландшафта
TerrainDetail terrain,4000,True

;увеличим ландшафт
ScaleEntity terrain,1,50,1

;применим текстуры к нашему ландшафту
grass_tex=LoadTexture( "остров.bmp" )
ScaleTexture grass_tex, 250, 250
EntityTexture terrain,grass_tex,0,1
detail=LoadTexture( "clip_image003.jpg" )
EntityTexture terrain,detail,0,1
EntityTexture terrain,grass_tex,0,2
ScaleTexture detail, 2,2
;создадим море
Global watermesh=LoadMesh("20x20mesh.3ds")
RotateMesh watermesh,90,0,0
RotateEntity watermesh,-90,0,0
ScaleEntity watermesh,15,15,15
PositionEntity watermesh, 0,6,0

watertexture=LoadAnimTexture("wateranim.jpg",256,124,124,0,25)
EntityTexture watermesh,watertexture,0,1
ScaleTexture watertexture,.005,.005
EntityShininess watermesh,0.5
EntityAlpha watermesh, 0.5
EntityFX watermesh, 32
;--------------------
Global waterflow# = 10
Global wavesize# = 0.06

Global surface=GetSurface(watermesh,1)

Global VertexCount=CountVertices(surface)

Type Vertices
Field x#
Field y#
Field z#
End Type

Dim Vertex.Vertices(VertexCount)

For A=0 To VertexCount-1
Vertex(a) = New Vertices
Vertex(a)\x#=VertexX#(surface,a)
Vertex(a)\y#=VertexY#(surface,a)
Vertex(a)\z#=VertexZ#(surface,a)
Next

While Not KeyDown( 1 )
;задаём параметры перемещения камеры по ландшафту
If KeyDown( 205 )=True Then TurnEntity cam,0,-1,0
If KeyDown( 203 )=True Then TurnEntity cam,0,1,0
If KeyDown( 208 )=True Then MoveEntity cam,0,0,-1
If KeyDown( 200 )=True Then MoveEntity cam,0,0,1

x#=EntityX(cam)
y#=EntityY(cam)
z#=EntityZ(cam)

terra_y#=TerrainY(terrain,x#,y#,z#)+3

PositionEntity cam,x#,terra_y#,z#
wd=wd+1
If wd=4
EntityTexture watermesh,watertexture,frame,2
frame=frame+1
If frame=22 Then frame=0
wd=0
EndIf

UpdateWater()
;"Оживляем" все сущности в нашем 3d мире
UpdateWorld
RenderWorld

Text 80,0,"Д Л Я П Е Р Е М Е Щ Е Н И Я И С П О Л Ь З У Й Т Е С Т Р Е Л О Ч К И Н А К Л А В И А Т У Р Е"
Flip
Wend
End

;функция обновления воды
Function UpdateWater()
For a=0 To VertexCount-1
Freq#=MilliSecs()/waterflow
Vertex(a)\z#=Sin(freq+Vertex(a)\x#*300+Vertex(a)\y#*400)*wavesize
;сделаем динамическую деформацию
VertexCoords surface,a,Vertex(a)\x#,Vertex(a)\y#,Vertex(a)\z#

Next
;пересчитаем сетку нормалей, для коректного освещения
UpdateNormals watermesh
;конец функции
End Function
Я хочу что-бы он здесь бегал...

Форум игроделов » Программирование » Basic » Мне нужна ваша помощь. Я хочу создать монстра на blitz basic (Монстр на Blitz Basic3d)
  • Страница 1 из 1
  • 1
Поиск:

Все права сохранены. GcUp.ru © 2008-2024 Рейтинг