Разработчик
Регистрация: 09.12.2007
Сообщений: 376
Написано 83 полезных сообщений (для 122 пользователей)
|
Ответ: Уже наболевшее..
вот пример:

Graphics3D 800,600,32,2
cam=CreateCamera()
PositionEntity cam,0,5,0
Type plasma_shots
Field plr,mesh,side,typ,time,life,tx#,ty#,tz#
End Type
Global GM1_power#=9
Global GM2_power#=15
Global GM3_power#=22
Global Weap_Ion1=CreateSphere();LoadMesh(GLBMeshpath$+"shoti.b3d")
;Global Ion_tex1=LoadTexture(GLBMeshpath$+"shot_ion2.png",1)
Global Weap_Ion2=CreateSphere();LoadMesh(GLBMeshpath$+"shoti.b3d")
;Global Ion_tex2=LoadTexture(GLBMeshpath$+"shot_ion1.png",1)
Global Weap_Ion3=CreateSphere();LoadMesh(GLBMeshpath$+"shotp.b3d")
;Global Ion_tex3=LoadTexture(GLBMeshpath$+"shot_plasma1.png",1)
Global weapon=CreateCube()
PositionEntity weapon,0,0,5
Global PShotSparkspr=CreateCube()
;LoadMesh(GLBMeshpath$+"shotp.b3d")
;EntityFX PShotSparkspr,5
;EntityBlend PShotSparkspr, 3
;EntityTexture PShotSparkspr,LoadTexture(GLBMeshpath$+"shot_plasma1.png",3)
Type PShotSpark
Field num, sprite, scale#, spd#, parent, alpha#, y#
End Type
Type Unit
Field mesh,w1t,t
End Type
u.unit=New unit
u\mesh=CreateCube()
u\t=CreatePivot(u\mesh)
ScaleEntity u\mesh,5,5,5
EntityColor u\mesh,150,50,50
PositionEntity u\mesh,0,0,160
EntityType u\mesh,2
EntityPickMode u\mesh,2
PositionEntity u\t,0,0,1000,1
While ((Not G_Exit) And (Not G_Restart))
If MouseHit(1) Then Crt_Ion_Shot(weapon,u\t,.01): u\w1t=35
UpdateShotPSpark()
UpdateIonShot()
UpdateWorld
RenderWorld
Flip ;0
If KeyHit(1) Then G_Exit=1
Wend
End
Function CrtPShotSpark(boat,vecy=0,vecp=0,ang=0,spd#=3,min#=2,max#=4)
splasher.PShotSpark=New PShotSpark
splasher\parent=boat
splasher\sprite=CopyEntity(PShotSparkspr)
RotateEntity splasher\sprite,vecp+Rnd(-ang,ang)-180,vecy+Rnd(-ang,ang),0
splasher\scale#=min#
splasher\spd#=spd#
ScaleEntity splasher\sprite,splasher\scale#,splasher\scale#,splasher\scale#*3
PositionEntity splasher\sprite,EntityX(splasher\parent,True),EntityY(splasher\parent,True),EntityZ(splasher\parent,True)
End Function
Function Crt_Ion_Shot(obj,t,spd#)
s.plasma_shots=New plasma_shots
s\mesh=CopyEntity(Weap_Ion1): s\life=60
tx#=EntityX#(obj,1) ty#=EntityY#(obj,1) tz#=EntityZ#(obj,1)
PositionEntity s\mesh,tx#,ty#,tz#
s\tx#=(EntityX#(t,1)-tx#+Rnd(-30,30))*spd# s\ty#=(EntityY#(t,1)-ty#+Rnd(-30,30))*spd# s\tz#=(EntityZ#(t,1)-tz#+Rnd(-30,30))*spd#
PointEntity s\mesh,t
EntityFX s\mesh,5
If GSound_ON EmitSound( ion_sound_01,obj )
End Function
Function UpdateShotPSpark()
For all.PShotSpark=Each PShotSpark
ScaleEntity all\sprite,all\scale#,all\scale#,all\scale#
all\scale#=all\scale#*1.1
MoveEntity all\sprite,0,0,2.0*dt#
If all\scale#>=1.01 Then FreeEntity all\sprite Delete all
Next
End Function
Function UpdateIonShot()
For all.plasma_shots=Each plasma_shots
all\life=all\life-1
TranslateEntity all\mesh,all\tx#,all\ty#,all\tz#,1
ob=EntityPick (all\mesh,15); ----------------Zamenit'!!!!!!!
If ob>0 Then
If GetEntityType (ob)=2 Then
LP#=GP1_power#
u.Unit=Object.Unit(EntityName(ob))
;u\health#=u\health#-(LP#*.01*(100-u\shield));If u\plr=0
;u\speed#=u\speed#*.6
CrtPShotSpark(all\mesh,EntityYaw(all\mesh),EntityPitch(all\mesh),200)
CrtPShotSpark(all\mesh,EntityYaw(all\mesh),EntityPitch(all\mesh),200)
CrtPShotSpark(all\mesh,EntityYaw(all\mesh),EntityPitch(all\mesh),20)
CrtPShotSpark(all\mesh,EntityYaw(all\mesh),EntityPitch(all\mesh),20)
CrtPShotSpark(all\mesh,EntityYaw(all\mesh),EntityPitch(all\mesh),20)
CrtPShotSpark(all\mesh,EntityYaw(all\mesh),EntityPitch(all\mesh),20)
EndIf
EndIf
If (all\life<=0) Or (ob) Then FreeEntity all\mesh Delete all
Next
End Function
П.С. а частицы видать неправильно генерируешь. Загрузи один прототип частицы, примени к нему все что нужно, и спрячь. Затем просто копируй и делай Анхайд. Тогда все частицы одинаковы будут.
Последний раз редактировалось FrankH, 13.07.2008 в 04:30.
|