hello! When compile:
gun = 102
SetVirtualResolution(GetDeviceWidth(),GetDeviceHeight())
AddVirtualJoystick( 2, GetDeviceWidth()-100, GetDeviceHeight()-100, 200 )
CreateObjectCone(gun,0.5,0.5,3)
type bullettype
x y z alive anglex angley anglez objectid
endtype
dim bullet[100] as bullettype
spr = 0
firerate = 10
fire = 0
do
shootangle# = wrap180(atanfull(GetVirtualJoystickX(2),GetVirtualJoystickY(2)))
if GetVirtualJoystickX(2) <> 0 or GetVirtualJoystickY(2) <> 0
if fire = firerate
SetObjectRotation(gun,0,shootangle#,0)
rem create a bullet
if spr = 100 then spr = 0
spr = spr + 1
createObjectBox(spr,0.1,0.1,0.1)
setObjectPosition(spr,GetObjectX(gun),GetObjectY(gun),GetObjectZ(gun))
SetObjectRotation(spr,GetObjectAngleX(gun),GetObjectAngleY(gun),GetObjectAngleZ(gun))
bullet[spr].alive = 1
bullet[spr].x = GetObjectX(gun)
bullet[spr].y = GetObjectY(gun)
bullet[spr].z = GetObjectZ(gun)
bullet[spr].anglex = GetObjectAngleX(spr)
bullet[spr].angley = GetObjectAngleY(spr)
bullet[spr].anglez = GetObjectAngleZ(spr)
fire = 0
else
fire = fire + 1
endif
endif
rem control bullet
for b=0 to 100
if bullet[b].alive=1
MoveObjectLocalZ(b,-0.5)
print (GetObjectX(b)-bullet[b].x)
print (GetObjectZ(b)-bullet[b].y)
if (GetObjectX(b)-bullet[b].x) > 20 then bullet[b].alive=0
if (GetObjectX(b)-bullet[b].x) < -20 then bullet[b].alive=0
if (GetObjectZ(b)-bullet[b].z) > 20 then bullet[b].alive=0
if (GetObjectZ(b)-bullet[b].z) < -20 then bullet[b].alive=0
else
DeleteObject(b)
endif
next b
Sync()
loop
function wrap180( v as float )
while v>180
v = v-360
endwhile
while v<-180
v = v+360
endwhile
endfunction v
Error
main.agc:7: error: Unexpected token "y"
CreateObjectCone(gun,0.5,0.5,3)
type bullettype
x y z alive anglex angley anglez objectid
endtype
dim bullet[100] as bullettype
where is the error?