ahh yes that works perfect thanks I mustve grabbed the wrong parts but using your function to extract the data
works well
The code so far, apologies the media file I sent has lots of stuff that's not used I had videos and all in there lol I removed mosy
of what I could see wasn't needed
// Project: BlockLifter
// Created: 2018-08-28
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "BlockLifter" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
#constant KEY_LEFT = 37 //the left arrow key scancode
#constant KEY_UP = 38 //the up arrow key scancode
#constant KEY_RIGHT = 39 //the right arrow key scancode
#constant KEY_DOWN = 40 //the down arrow key scancode
#constant KEY_SPACE = 32 //the space bar
#constant bulletLife = 1.5
//images and textures
#constant boxTextureD =1
//#constant boxTextureN =2
#constant treeD =3
//#constant treeN =5
#constant heliD =4
//#constant heliA =5
#constant fuelD =6
#constant medsD =7
#constant turretD =8
#constant planetD =9
#constant planetN =10
#constant baseD =11
#constant missileImg =12
#constant missileImg2 =13
#constant explosionImg=14
#constant smokeImg =15
#constant frameImg =16
#constant helipadD =17
//3d Objects
#constant heliObj =1
#constant heliBladesObj=2
#constant heliTailObj =3
#constant missileObj =4
#constant fuelObj =5
#constant medsObj =6
#constant baseObj =7
#constant turretObj =8
#constant boxObj =9
#constant treeObj =10
#constant worldObj =11
#constant helipadObj =12
#constant helipad2Obj =13
//text
#constant titleTxt =1
#constant holdingTxt =2
#constant rescuedTxt =3
#constant fuelTxt =4
#constant altTxt =5
#constant livesTxt =6
//Sprites
#constant explosionSpr=1
#constant frameSpr =2
//Shaders
//#constant neonShader =1
//Variables
#constant Depth#=10
type _boxes
id
x#
y#
z#
lastFiredTime#
pickedup as integer
endtype
type vertex
x as float
y as float
z as float
endtype
// the type used for bullets
type bullet
ID as integer
time as float // a time used because bullets die over time
endtype
type explosion
ID as integer
endtype
SetGenerateMipmaps( 1 )
//load images
LoadImage(boxTextureD,"box2.png")
loadImage(treeD,"firtree_2D.png")
LoadImage(heliD,"chopper7.png")
LoadImage(planetD,"sphere1.png")
LoadImage(fuelD,"fuel2.png")
LoadImage(medsD,"heartD.png")
LoadImage(baseD,"base.png")
LoadImage(turretD,"turret.png")
LoadImage(frameImg,"frame.png")
LoadImage(explosionImg,"explosionG.png")
LoadImage(smokeImg,"smokeG.png")
LoadImage(helipadD,"helipadD.png")
LoadObject(fuelObj,"fuel.3ds")
LoadObject(medsObj,"heart.obj")
LoadObject(baseObj,"base.3ds")
LoadObject(turretObj,"turret.3ds")
LoadObject(boxObj,"box.3ds")
LoadObject(treeObj,"firtree2.x")
LoadObject(heliObj,"chopper.3ds")
loadObject(heliBladesObj,"blades.3ds")
loadObject(heliTailObj,"tail.3ds")
LoadObject(worldObj,"sphere1.obj")
LoadObject(helipadObj,"helipad.obj")
SetObjectVisible(fuelObj,0)
SetObjectVisible(medsObj,0)
SetObjectVisible(baseObj,0)
SetObjectVisible(turretObj,0)
SetObjectVisible(boxObj,0)
SetObjectVisible(treeObj,0)
global turrets as _boxes[]
global bases as _boxes[]
global blocks as _boxes[]
global trees as _boxes[]
global meds as _boxes[]
global fuel as _boxes[]
global verts as vertex[]
global empty as _boxes
global planetMissile as bullet[0]
global playerBomb as bullet[0]
global missileCount=0
box=CreateObjectBox(1,1,1)
SetObjectVisible(box,0)
r#=20
create3DPhysicsWorld()
boxnumber=0
loadvertex("sphere1.obj")
//global maxx#,maxy#,maxz#
//global minx#,miny#,minz#
SetObjectImage(helipadObj,helipadD,0)
SetObjectPosition(helipadObj,0,19.5,0)
//SetObjectRotation(helipadObj,0, 0, 0 )
FixObjectToObject(helipadObj,box)
InstanceObject(helipad2Obj,helipadObj)
SetObjectImage(helipad2Obj,helipadD,0)
SetObjectPosition(helipad2Obj,0,-19.5,0)
SetObjectRotation(helipad2Obj,0, 0, 180 )
FixObjectToObject(helipad2Obj,box)
for i=0 to verts.length
x#=verts[i].x
y#=verts[i].y
z#=verts[i].z
//if x# > maxx# then maxx#=x#
//if y# > maxy# then maxy#=y#
//if z# > maxz# then maxz#=z#
//if x# < minx# then minx#=x#
//if y# < miny# then miny#=y#
//if z# < minz# then minz#=z#
if objectraycast(0,x#-2,y#-2,z#-2,x#+2,y#+2,z#+2) =0
empty.x#=x#
empty.y#=y#
empty.z#=z#
//empty.fired=0
a=random(1,25)
if a>15
empty.id = InstanceObject(baseObj)
bases.insert(empty)
SetObjectImage(empty.id,baseD,0)
SetObjectLightMode(empty.id,0)
SetObjectPosition(empty.id,empty.x#,empty.y#,empty.z#)
SetObjectLookAt(empty.id, 0, 0, 0, 0 )
RotateObjectLocalX(empty.id,275)
FixObjectToObject(empty.id,box)
SetObjectVisible(empty.id,1)
b=random(1,10)
if b>5
empty.id = InstanceObject(turretObj)
empty.lastFiredTime#=0
SetObjectImage(empty.id,turretD,0)
SetObjectLightMode(empty.id,0)
SetObjectPosition(empty.id,empty.x#,empty.y#,empty.z#)
SetObjectLookAt(empty.id, 0, 0, 0, 0 )
RotateObjectLocalX(empty.id,275)
FixObjectToObject(empty.id,box)
SetObjectVisible(empty.id,1)
turrets.insert(empty)
inc boxnumber
elseif b>2
empty.id = InstanceObject(fuelObj)
fuel.insert(empty)
SetObjectImage(empty.id,fuelD,0)
SetObjectLightMode(empty.id,0)
SetObjectPosition(empty.id,empty.x#,empty.y#,empty.z#)
SetObjectLookAt(empty.id, 0, 0, 0, 0 )
RotateObjectLocalX(empty.id,275)
FixObjectToObject(empty.id,box)
SetObjectVisible(empty.id,1)
else
empty.id = InstanceObject(medsObj)
meds.insert(empty)
SetObjectImage(empty.id,medsD,0)
//SetObjectColor(empty.id,255,255,255,255)
SetObjectLightMode(empty.id,0)
SetObjectPosition(empty.id,empty.x#,empty.y#,empty.z#)
SetObjectLookAt(empty.id, 0, 0, 0, 0 )
RotateObjectLocalX(empty.id,275)
FixObjectToObject(empty.id,box)
SetObjectVisible(empty.id,1)
endif
elseif a>10
empty.id = InstanceObject(treeObj)
SetObjectScale(empty.id,.04,.04,.04)
SetObjectPosition(empty.id,empty.x#,empty.y#,empty.z#)
SetObjectImage(empty.id,treeD,0)
//SetObjectNormalMap(empty.id,treeN)
SetObjectLightMode(empty.id,0)
SetObjectColor(empty.id,0,150,0,255)
SetObjectLookAt(empty.id, 0, 0, 0, 0 )
RotateObjectLocalX(empty.id,-90)
FixObjectToObject(empty.id,box)
SetObjectVisible(empty.id,1)
trees.insert(empty)
else
empty.id = InstanceObject(boxObj)
empty.pickedup=0
setObjectImage(empty.id,boxTextureD,0)
SetObjectLightMode(empty.id,0)
SetObjectPosition(empty.id,empty.x#,empty.y#,empty.z#)
SetObjectLookAt(empty.id, 0, 0, 0, 0 )
blocks.insert(empty)
SetObjectVisible(empty.id,1)
FixObjectToObject(empty.id,box)
endif
endif
next
// next
SetObjectImage(heliObj,heliD,0)
//SetObjectImage(heliObj,heliA,1)
SetObjectImage(heliBladesObj,heliD,0)
//SetObjectImage(heliBladesObj,bladesA,1)
SetObjectImage(heliTailObj,heliD,0)
//SetObjectImage(heliTailObj,bladesA,1)
//SetObjectColor(heliBladesObj,255,255,255,255)
//SetObjectColor(heliTailObj,255,255,255,255)
SetObjectLightMode(heliObj,0)
SetObjectLightMode(heliBladesObj,0)
SetObjectLightMode(heliTailObj,0)
FixObjectToObject(heliBladesObj,heliObj)
SetObjectPOsition(heliTailObj,1.5,.3,.1)
FixObjectToObject(heliTailObj,heliObj)
SetObjectDepthWrite(heliBladesObj, 1 )
SetObjectCullMode(heliBladesObj, 0)
SetObjectDepthWrite(heliTailObj, 1 )
SetObjectCullMode(heliTailObj, 0)
SetObjectRotation(heliObj,0,90,-50)
SetObjectCollisionMode(heliObj,1)
SetObjectScale(worldObj,39,39,39)
SetObjectImage(worldObj,planetD,0)
FixObjectToObject(worldObj,box)
CreateSprite(explosionSpr,explosionImg)
SetSpriteImage(explosionSpr,explosionImg)
SetSpriteAnimation(explosionSpr,256,256,25)
SetSpriteSize(explosionSpr,256,256)
SetSpritePositionByOffset(explosionSpr,512,225)
SetSpriteVisible(explosionSpr,0)
CreateSprite(frameSpr,frameImg)
lives=5:missileCount=0:state=0:pickedupCounter=0:basesDestroyed=0:rescued=0:fuel#=100
SetPrintColor(0,255,0)
SetCameraPosition(1,0,15,-30)
Set3DPhysicsGravity( 0, 0, 0 )
SetObjectPosition(heliObj,0,12,-22)
CreateText(titleTxt,"Block-Lifter")
SetTextPosition(titleTxt,412,0)
SetTextColor(titleTxt,0,255,0,255)
SetTextSize(titleTxt,50)
CreateText(altTxt,"Alt:0")
SetTextPosition(altTxt,352,40)
SetTextColor(altTxt,0,255,0,255)
SetTextSize(altTxt,30)
CreateText(fuelTxt,"F:100")
SetTextPosition(fuelTxt,452,40)
SetTextColor(fuelTxt,0,255,0,255)
SetTextSize(fuelTxt,30)
CreateText(holdingTxt,"H:0")
SetTextPosition(holdingTxt,552,40)
SetTextColor(holdingTxt,0,255,0,255)
SetTextSize(holdingTxt,30)
CreateText(rescuedTxt,"R:0")
SetTextPosition(rescuedTxt,652,40)
SetTextColor(rescuedTxt,0,255,0,255)
SetTextSize(rescuedTxt,30)
CreateText(livesTxt,"L:0")
SetTextPosition(livesTxt,752,40)
SetTextColor(livesTxt,0,255,0,255)
SetTextSize(livesTxt,30)
a=0:b=0
do
RotateObjectGlobalY(heliBladesObj,20)
RotateObjectGlobalZ(heliTailObj,15)
if GetRawKeyState(KEY_UP)
SetObjectRotation(heliObj,0,90,-50)
moveWorld(box,-1,0,0)
endif
if GetRawKeyState(KEY_DOWN)
SetObjectRotation(heliObj,0,90,-50)
moveWorld(box,2,0,0)
endif
if GetRawKeyState(KEY_LEFT)
SetObjectRotation(heliObj,-25,90,-50)
moveWorld(box,0,0,-1)
endif
if GetRawKeyState(KEY_RIGHT)
SetObjectRotation(heliObj,25,90,-50)
moveWorld(box,0,0,1)
endif
if GetrawkeyPressed(KEY_SPACE)
dropBomb(heliObj,worldObj, 20.0, 10.0)
endif
numBombs=playerBomb.length
for num2= boxnumber-1 to 1 step-1
for num= numBombs to 1 step-1
if numBombs>0
if GetObjectVisible(turrets[num2].id) and objectraycast(turrets[num2].id,getObjectX(playerBomb[num].ID)-1.0,getObjectY(playerBomb[num].ID)-1.0,getObjectZ(playerBomb[num].ID)-1.0,getObjectX(playerBomb[num].ID)+1.0,getObjectY(playerBomb[num].ID)+1.0,getObjectZ(playerBomb[num].ID)+1.0)
SetObjectVisible(turrets[num2].id,0)
part2ID=Create3DParticles( getObjectX(playerBomb[num].ID),getObjectY(playerBomb[num].ID),getObjectZ(playerBomb[num].ID) )
Set3DParticlesDirection( part2ID, 0,2, 0, 0 )
Set3DParticlesDirectionRange( part2ID,275,45 )
Set3DParticlesFrequency( part2ID, 100 )
Set3DParticlesImage(part2ID,smokeImg)
Set3DParticlesSize(part2ID,1)
Set3DParticlesLife(part2ID,.25)
Set3DParticlesVelocityRange(part2ID,1,10)
Set3DParticlesMax(part2ID,150)
inc basesDestroyed
exit
endif
endif
next num
next num2
//clean up bombs
numBombs=playerBomb.length
for num= numBombs to 0 step-1
if timer()>playerBomb[num].time+bulletLife
DeleteObject(playerBomb[num].ID)
playerBomb.remove(num)
endif
next
for num =0 to boxnumber-1
//shoot at plane if in range
towerNum=num
if timer()>turrets[towerNum].lastFiredTime#+.75 and GetObjectVisible(turrets[towerNum].id) and getDistance(turrets[towerNum].id,heliObj)<6
//ang# = get2DAngle(getObjectX(turrets[towerNum].id),getObjectZ(turrets[towerNum].id),getObjectX(heliObj),getObjectZ(heliObj))
//RotateObjectLocalY(turrets[towerNum].id,ang#)
turrets[towerNum].lastFiredTime#=timer()
shootMissile( turrets[towerNum].id,heliObj, 30.0, 50.0)
endif
next num
missileNum=missileCount //check if the heli has been shot
for num=missileNum to 1 step -1
if state=0 and objectraycast(heliObj,getObjectX(planetMissile[num].ID)-0.25,getObjectY(planetMissile[num].ID)-0.25,getObjectZ(planetMissile[num].ID)-22,getObjectX(planetMissile[num].ID)+0.25,getObjectY(planetMissile[num].ID)+0.25,getObjectZ(planetMissile[num].ID))
dec lives:state=1
endif
//remove old bullets
if (planetMissile[num].time)+bulletLife<timer()
DeleteObject(planetMissile[num].ID)
planetMissile.remove(num)
dec missileCount
endif
next num
pickupNum=blocks.length //pick up blocks and move them
for num =pickupNum to 1 step-1
if blocks[num].pickedup=0 and objectraycast(blocks[num].id,getObjectX(heliObj)-0.5,getObjectY(heliObj)-1.5,getObjectZ(heliObj)-0.5,getObjectX(heliObj)+0.5,getObjectY(heliObj)+0.5,getObjectZ(heliObj)+10)
inc pickedupCounter:blocks[num].pickedup=pickedupCounter
FixObjectToObject(blocks[num].id,0)
//SetObjectPosition(blocks[num].id,(1.2*pickedupCounter)+1.25,0,0)
SetObjectPosition(blocks[num].id,getObjectX(heliObj),getObjectY(heliObj)-(0.75*pickedupCounter)-1.25,getObjectZ(heliObj))
SetObjectRotation(blocks[num].id,0,0,0)
//FixObjectToObject(blocks[num].id,shipBlock)
endif
if blocks[num].pickedup>0
if GetObjectAngleX(heliObj)<0
SetObjectPosition(blocks[num].id,getObjectX(heliObj)-((blocks[num].pickedup)*.15)+.75,getObjectY(blocks[num].id),getObjectZ(blocks[num].id))
elseif GetObjectAngleX(heliObj)>0
SetObjectPosition(blocks[num].id,getObjectX(heliObj)+((blocks[num].pickedup)*.15)-.75,getObjectY(blocks[num].id),getObjectZ(blocks[num].id))
else
SetObjectPosition(blocks[num].id,getObjectX(heliObj),getObjectY(blocks[num].id),getObjectZ(blocks[num].id))
endif
endif
next num
//drop blocks off at helipad
if objectraycast(helipadObj,getObjectX(heliObj)-0.5,getObjectY(heliObj)-1.5,getObjectZ(heliObj)-0.5,getObjectX(heliObj)+0.5,getObjectY(heliObj)+0.5,getObjectZ(heliObj)+10) or objectraycast(helipad2Obj,getObjectX(heliObj)-0.5,getObjectY(heliObj)-1.5,getObjectZ(heliObj)-0.5,getObjectX(heliObj)+0.5,getObjectY(heliObj)+0.5,getObjectZ(heliObj)+10)
for num =pickupNum to 1 step-1
if blocks[num].pickedup>0
blocks[num].pickedup=0
SetObjectVisible(blocks[num].id,0)
Dec pickedupCounter: inc rescued
endif
next num
endif
//pickup health
for num =meds.length to 1 step-1
if GetObjectVisible(meds[num].id) and objectraycast(meds[num].id,getObjectX(heliObj)-0.5,getObjectY(heliObj)-1.5,getObjectZ(heliObj)-0.5,getObjectX(heliObj)+0.5,getObjectY(heliObj)+0.5,getObjectZ(heliObj)+10)
inc lives
SetObjectVisible(meds[num].id,0)
endif
next num
for num =fuel.length to 1 step-1
if GetObjectVisible(fuel[num].id) and objectraycast(fuel[num].id,getObjectX(heliObj)-0.5,getObjectY(heliObj)-1.5,getObjectZ(heliObj)-0.5,getObjectX(heliObj)+0.5,getObjectY(heliObj)+0.5,getObjectZ(heliObj)+10)
fuel#=fuel#+10
SetObjectVisible(fuel[num].id,0)
endif
next num
if state=1
if Get3DParticlesExists(partID) then Delete3DParticles(partID)
partID=Create3DParticles( getObjectX(heliObj),getObjectY(heliObj),getObjectZ(heliObj) )
Set3DParticlesDirection( partID, 0,2, 0, 0 )
Set3DParticlesDirectionRange( partID,275,45 )
Set3DParticlesFrequency( partID, 75 )
Set3DParticlesImage(partID,smokeImg)
Set3DParticlesSize(partID,1)
Set3DParticlesLife(partID,1.0)
Set3DParticlesVelocityRange(partID,1,10)
Set3DParticlesMax(partID,275)
state=2
endif
pickupNum=blocks.length
if state=2
if getObjectZ(heliObj)<-12
SetObjectPosition(heliObj,getObjectX(heliObj),getObjectY(heliObj),getObjectZ(heliObj)+.1)
if GetParticlesExists(partID) then Set3DParticlesPosition(partID,getObjectX(heliObj),getObjectY(heliObj),getObjectZ(heliObj))
for num =pickupNum to 1 step-1
if blocks[num].pickedup>0 then SetObjectPosition(blocks[num].id,getObjectX(blocks[num].id),getObjectY(blocks[num].id),getObjectZ(blocks[num].id)+.1)
next num
else
//Delete3DParticles(partID)
state=3
endif
if getObjectZ(heliObj)>=-14 and GetSpritePlaying(explosionSpr)=0
SetSpriteVisible(explosionSpr,1)
playSprite(explosionSpr,10,0)
inc rescued
endif
endif
if state=3 and GetSpritePlaying(explosionSpr)=0
SetSpriteVisible(explosionSpr,0)
SetObjectPosition(heliObj,0,12,-22)
state=0:fuel#=100
for num =pickupNum to 1 step-1
if blocks[num].pickedup>0 then SetObjectPosition(blocks[num].id,getObjectX(heliObj),getObjectY(blocks[num].id),getObjectZ(heliObj))
next num
endif
SetTextString(holdingTxt,"H:"+Str(pickedupCounter))
SetTextString(rescuedTxt,"R:"+Str(rescued))
SetTextString(livesTxt,"L:"+Str(lives))
SetTextString(fuelTxt,"F:"+Str(Trunc(fuel#)))
SetTextString(altTxt,"Alt:"+Str(Trunc(ABS(GetObjectZ(heliObj))-12)))
//Print("Blocks Left "+str(blocks.length-pickedupCounter))
//Print("Bases Destroyed "+str(basesDestroyed))
//Print("Bases Left "+str(turrets.length-basesDestroyed))
Step3DPhysicsWorld()
//Print( ScreenFPS() )
fuel#=fuel#-.025:if fuel#<0 then fuel#=0:if fuel#=0 and state=0 then state=2
Sync()
loop
function moveWorld(objID as integer,ax#,ay#,az#)
RotateObjectGlobalX(objID,ax#)
RotateObjectGlobalY(objID,ay#)
RotateObjectGlobalZ(objID,az#)
endfunction
function shootMissile(objectId as integer,objectID2 as integer,initialSpeed as float, mass as float)
//To move dynamic physics bodies we need to apply velocity to the physics body.
gunPositionVec= CreateVector3(GetObjectWorldX(objectId),GetObjectWorldY(objectId),GetObjectWorldZ(objectId)) //im using the camera position as the gun position
//Create a tempory projectile block to calculate movement vectors of bullets
projectileDirBox as integer
projectileDirBox = CreateObjectBox( 1.0, 1.0, 1.0 )
SetObjectPosition( projectileDirBox, GetVector3X( gunPositionVec ), GetVector3Y( gunPositionVec ), GetVector3Z( gunPositionVec ) )
//setobjectrotation(projectiledirbox,-55.0,GetObjectAngleY(objectId),270.0)
setobjectrotation(projectiledirbox,GetObjectWorldAngleX(objectId),GetObjectWorldAngleY(objectId),GetObjectWorldAngleZ(objectId))
//SetObjectLookAt(projectiledirbox,GetObjectWorldX(objectID2),GetObjectWorldY(objectID2),GetObjectWorldZ(objectID2),0)
MoveObjectLocalZ( projectileDirBox, -1.0 )
projectileDirVec = CreateVector3( GetobjectWorldX( projectileDirBox )-GetVector3X( gunPositionVec ), GetobjectWorldY( projectileDirBox )-GetVector3Y( gunPositionVec ), GetobjectWorldZ( projectileDirBox )-GetVector3Z( gunPositionVec ) )
//DeleteObject( projectileDirBox )
missile as integer
missile = CreateObjectSphere(.4,5,5)
//bullet = CreateObjectSphere(.45,.45,.45 )
//missile=InstanceObject(worldObj)
//SetObjectImage(missile,planetD,0)
SetObjectColor(missile, 0, 255,0,255 )
SetObjectLightMode(missile,0)
SetObjectPosition(missile, GetVector3X( gunPositionVec ), GetVector3Y( gunPositionVec ), GetVector3Z( gunPositionVec ) )
SetObjectRotation(missile,GetObjectAngleX(projectileDirBox),GetObjectAngleY(projectileDirBox),GetObjectAngleZ(projectileDirBox)+180)
//RotateObjectLocalZ(missile,90)
DeleteObject( projectileDirBox )
//3D Physics code
Create3DPhysicsDynamicBody(missile)
//SetObjectShapeSphere( bullet )
SetObject3DPhysicsMass(missile, mass )
SetObject3DPhysicsLinearVelocity(missile, projectileDirVec, initialSpeed )
myItem as bullet
myItem.ID = missile //the object id of the bullet
myItem.time = timer() //timer is used to set there life time as bullets will die off after so long
planetMissile.insert(myItem) //update bullet arrow as there is unlimeted bullets
inc missileCount //used for a bullet counter to check if theyve timed out or not
deletevector3(projectileDirVec)
deletevector3(gunPositionVec)
endfunction
function dropBomb(objectId as integer,objectID2 as integer,initialSpeed as float, mass as float)
//To move dynamic physics bodies we need to apply velocity to the physics body.
gunPositionVec= CreateVector3(GetObjectWorldX(objectId),GetObjectWorldY(objectId),GetObjectWorldZ(objectId)+4) //im using the camera position as the gun position
//Create a tempory projectile block to calculate movement vectors of bullets
projectileDirBox as integer
projectileDirBox = CreateObjectBox( 1.0, 1.0, 1.0 )
SetObjectPosition( projectileDirBox, GetVector3X( gunPositionVec ), GetVector3Y( gunPositionVec ), GetVector3Z( gunPositionVec ) )
//setobjectrotation(projectiledirbox,GetObjectWorldAngleX(objectId),GetObjectWorldAngleY(objectId),GetObjectWorldAngleZ(objectId))
//SetObjectLookAt(projectiledirbox,GetObjectX(objectId),GetObjectY(objectId),GetObjectZ(objectId)+5,0)
setobjectrotation(projectiledirbox,315,0.0,0.0) //270 x rot is straight ahead
if GetObjectAngleX(objectId)< 0 then MoveObjectLocalX( projectileDirBox, -0.55 )
if GetObjectAngleX(objectId)> 0 then MoveObjectLocalX( projectileDirBox, 0.55 )
//RotateObjectLocalX(projectileDirBox,(GetObjectAngleX(objectId)))
MoveObjectLocalY( projectileDirBox,-0.50 )
MoveObjectLocalZ( projectileDirBox,1.0 )
projectileDirVec = CreateVector3( GetobjectWorldX( projectileDirBox )-GetVector3X( gunPositionVec ), GetobjectWorldY( projectileDirBox )-GetVector3Y( gunPositionVec ), GetobjectWorldZ( projectileDirBox )-GetVector3Z( gunPositionVec ) )
//DeleteObject( projectileDirBox )
bomb as integer
bomb = CreateObjectSphere(.4,5,5)
//bomb=InstanceObject(worldObj)
//SetObjectImage(bomb,planetD,0)
SetObjectColor(bomb, 0, 255,0,255 )
SetObjectScale(bomb,1,1,1)
SetObjectLightMode(bomb,0)
//SetObjectTransparency(missileObj,1)
SetObjectPosition(bomb, GetVector3X( gunPositionVec ), GetVector3Y( gunPositionVec ), GetVector3Z( gunPositionVec ) )
//RotateObjectLocalX(bomb,180)
RotateObjectLocalY(bomb,270)
DeleteObject( projectileDirBox )
//3D Physics code
Create3DPhysicsDynamicBody( bomb )
//SetObjectShapeSphere( bullet )
SetObject3DPhysicsMass(bomb, mass )
SetObject3DPhysicsLinearVelocity(bomb, projectileDirVec, initialSpeed )
myItem as bullet
myItem.ID = bomb //the object id of the bullet
myItem.time = timer() //timer is used to set there life time as bullets will die off after so long
playerBomb.insert(myItem) //update bullet arrow as there is unlimeted bullets
//inc bulletCount //used for a bullet counter to check if theyve timed out or not
deletevector3(projectileDirVec)
deletevector3(gunPositionVec)
endfunction
function getDistance(objectID as integer,objectID2 as integer)
distance as float
vec1=CreateVector3(GetObjectWorldX(objectID),GetObjectWorldY(objectID),GetObjectWorldZ(objectID))
vec2=CreateVector3(GetObjectWorldX(objectID2),GetObjectWorldY(objectID2),GetObjectWorldZ(objectID2))
distance=GetVector3Distance(vec1,vec2 )
DeleteVector3(vec1)
DeleteVector3(vec2)
endfunction distance
function get2DAngle(x1#, y1#, x2#, y2#)
//result# = ATanFull(x1# - x2#, y1# - y2#)
result# = ATan2(x1# - x2#,y1# - y2#)
endfunction result#
function wrapvalue(num as float)
while num<0
num=num+360
endwhile
while num>360
num=num-360
endwhile
endfunction num
function LoadVertex(name as string)
f as integer
l as String
v as vertex
f = OpenToRead(name)
l = ReadLine(f)
while(FileEOF(f) = 0)
if mid(l,1,2) = "v "
v.x = ValFloat(GetStringToken(l, " ", 2)) * 39
v.y = ValFloat(GetStringToken(l, " ", 3)) * 39
v.z = ValFloat(GetStringToken(l, " ", 4)) * 39
verts.insert(v)
endif
l = ReadLine(f)
endwhile
endfunction
I was thinking in the beginning of using my neon shader but for this project I think SetObjectLightMode(objectid,0) works quite well
fubar