Is there any way to tweak the poisitions at runtime in the console?
vertex3dXtransformed[0] = -100
But I don't understand the edges fully, I'd love to make a small circle :D
edge[i][0] =
edge[i][1] =
edge[i][2] =
edge[i][3] =
edge[i][4] =
Is there any way to reefer to the WHOLE of an array/matrix? Say I had the array
x = {0,1,2,3,4,5,6,7,8,9}
Can refer to the whole thing at once?
function DrawSphere(xpos,ypos,zpos)
-- vertices
i = numberofvertices
firstvert = i
--0
--Ultimate 1
vertex3dX[i] = xpos + (math.cos(45*0/360*math.pi*2)*100)
vertex3dY[i] = ypos + (math.sin(45*0/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.sin(45*0/360*math.pi*2)*100)
i = i + 1
--1
vertex3dX[i] = xpos + (math.cos(45*1/360*math.pi*2)*100)
vertex3dY[i] = ypos + (math.sin(45*0/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.sin(45*1/360*math.pi*2)*100)
i = i + 1
--2
--Ultimate 2
vertex3dX[i] = xpos + (math.cos(45*2/360*math.pi*2)*100)
vertex3dY[i] = ypos + (math.sin(45*0/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.sin(45*2/360*math.pi*2)*100)
i = i + 1
--3
vertex3dX[i] = xpos + (math.cos(45*3/360*math.pi*2)*100)
vertex3dY[i] = ypos + (math.sin(45*0/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.sin(45*3/360*math.pi*2)*100)
i = i + 1
--4
--Ultimate 3
vertex3dX[i] = xpos + (math.cos(45*4/360*math.pi*2)*100)
vertex3dY[i] = ypos + (math.sin(45*0/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.sin(45*4/360*math.pi*2)*100)
i = i + 1
--5
vertex3dX[i] = xpos + (math.cos(45*5/360*math.pi*2)*100)
vertex3dY[i] = ypos + (math.sin(45*0/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.sin(45*5/360*math.pi*2)*100)
i = i + 1
--6
--Ultimate 4
vertex3dX[i] = xpos + (math.cos(45*6/360*math.pi*2)*100)
vertex3dY[i] = ypos + (math.sin(45*0/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.sin(45*6/360*math.pi*2)*100)
i = i + 1
--7
vertex3dX[i] = xpos + (math.cos(45*7/360*math.pi*2)*100)
vertex3dY[i] = ypos + (math.sin(45*0/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.sin(45*7/360*math.pi*2)*100)
i = i + 1
--8
vertex3dX[i] = xpos + (math.cos(45*1/360*math.pi*2)*100)
vertex3dY[i] = ypos + (math.sin(45*1/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.sin(45*0/360*math.pi*2)*100)
i = i + 1
--Ultimate 5
--9
vertex3dX[i] = xpos + (math.cos(45*2/360*math.pi*2)*100)
vertex3dY[i] = ypos + (math.sin(45*2/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.sin(45*0/360*math.pi*2)*100)
i = i + 1
--10
vertex3dX[i] = xpos + (math.cos(45*3/360*math.pi*2)*100)
vertex3dY[i] = ypos + (math.sin(45*3/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.sin(45*0/360*math.pi*2)*100)
i = i + 1
--11
vertex3dX[i] = xpos + (math.cos(45*5/360*math.pi*2)*100)
vertex3dY[i] = ypos + (math.sin(45*5/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.sin(45*0/360*math.pi*2)*100)
i = i + 1
--Ultimate 6
--12
vertex3dX[i] = xpos + (math.cos(45*6/360*math.pi*2)*100)
vertex3dY[i] = ypos + (math.sin(45*6/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.sin(45*0/360*math.pi*2)*100)
i = i + 1
--13
vertex3dX[i] = xpos + (math.cos(45*7/360*math.pi*2)*100)
vertex3dY[i] = ypos + (math.sin(45*7/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.sin(45*0/360*math.pi*2)*100)
i = i + 1
--14
vertex3dX[i] = xpos + 0
vertex3dY[i] = ypos + (math.sin(45*1/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.cos(45*1/360*math.pi*2)*100)
i = i + 1
--15
vertex3dX[i] = xpos + 0
vertex3dY[i] = ypos + (math.sin(45*3/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.cos(45*3/360*math.pi*2)*100)
i = i + 1
--16
vertex3dX[i] = xpos + 0
vertex3dY[i] = ypos + (math.sin(45*5/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.cos(45*5/360*math.pi*2)*100)
i = i + 1
--17
vertex3dX[i] = xpos + 0
vertex3dY[i] = ypos + (math.sin(45*7/360*math.pi*2)*100)
vertex3dZ[i] = zpos + (math.cos(45*7/360*math.pi*2)*100)
i = i + 1
numberofvertices = i
-- edges
i = vertexID
edge[i][0] = firstvert + 1
edge[i][1] = firstvert + 7
edge[i][2] = firstvert + 13
edge[i][3] = firstvert + 8
i = i + 1
edge[i][0] = firstvert + 0
edge[i][1] = firstvert + 2
edge[i][2] = firstvert + 13
edge[i][3] = firstvert + 8
edge[i][4] = firstvert + 14
edge[i][5] = firstvert + 17
i = i + 1
edge[i][0] = firstvert + 1
edge[i][1] = firstvert + 3
edge[i][2] = firstvert + 14
edge[i][3] = firstvert + 17
i = i + 1
edge[i][0] = firstvert + 2
edge[i][1] = firstvert + 4
edge[i][2] = firstvert + 14
edge[i][3] = firstvert + 17
edge[i][4] = firstvert + 10
edge[i][5] = firstvert + 11
i = i + 1
edge[i][0] = firstvert + 3
edge[i][1] = firstvert + 5
edge[i][2] = firstvert + 10
edge[i][3] = firstvert + 11
i = i + 1
edge[i][0] = firstvert + 4
edge[i][1] = firstvert + 6
edge[i][2] = firstvert + 10
edge[i][3] = firstvert + 11
edge[i][4] = firstvert + 16
edge[i][5] = firstvert + 15
i = i + 1
edge[i][0] = firstvert + 5
edge[i][1] = firstvert + 7
edge[i][2] = firstvert + 16
edge[i][3] = firstvert + 15
i = i + 1
edge[i][0] = firstvert + 6
edge[i][1] = firstvert + 0
edge[i][2] = firstvert + 16
edge[i][3] = firstvert + 15
edge[i][4] = firstvert + 13
edge[i][5] = firstvert + 8
i = i + 1
edge[i][0] = firstvert + 9
edge[i][1] = firstvert + 15
edge[i][2] = firstvert + 14
i = i + 1
edge[i][0] = firstvert + 15
edge[i][1] = firstvert + 14
edge[i][2] = firstvert + 10
i = i + 1
edge[i][0] = firstvert + 15
edge[i][1] = firstvert + 14
i = i + 1
edge[i][0] = firstvert + 12
edge[i][1] = firstvert + 16
edge[i][2] = firstvert + 17
i = i + 1
edge[i][0] = firstvert + 13
edge[i][1] = firstvert + 16
edge[i][2] = firstvert + 17
i = i + 1
edge[i][0] = firstvert + 16
edge[i][1] = firstvert + 17
i = i + 1
end
function LevelSetup()
Globals.G.Asteroids=0
Globals.G.EnemyFactionsMin=0
Globals.G.EnemyFactionsMax=0
SetBackdropColour(0,0,0)
AddAsteroid(0,0)
Globals.Flowers.Available = 0
Initialization()
BasicSaveFolder = "C:\\EufloriaSaves\\"
end
function LevelLogic()
GetAsteroid(0).Radius = 0
GetAsteroid(0):Hide(1)
GetAsteroid(0):SetVisible(1,false)
end
function LevelDraw()
if Limits == true then
SetBackdropColour(Br,Bg,Bb)
SetCameraZoomNow(PlayerSight/3.33)
end
GridSizeX = GetScreenWidth()/16
GridSizeY = GetScreenHeight()/16
if FreeCam == true then
PlayerX = GetCameraX()
PlayerY = GetCameraY()
else
CurrentXPos = GetCameraX()
CurrentYPos = GetCameraY()
if CurrentXPos ~= PlayerX then
local Way = CurrentXPos - PlayerX / math.abs(CurrentXPos - PlayerX)
if PlayerX/GridSizeX < math.ceil(PlayerX/GridSizeX) and PlayerX/GridSizeX > math.floor(PlayerX/GridSizeX) then
PlayerX = PlayerX + WalkingSpeed*Way
else
if BIs[In[math.floor(PlayerX/GridSizeX)+Way .. "," .. math.floor(PlayerY/GridSizeY)] ] ~= 1 then
else
PlayerX = PlayerX + WalkingSpeed*Way
end
end
end
if CurrentYPos ~= PlayerY then
local Way = CurrentYPos - PlayerY / math.abs(CurrentYPos - PlayerY)
if PlayerY/GridSizeY < math.ceil(PlayerY/GridSizeY) and PlayerY/GridSizeY > math.floor(PlayerY/GridSizeY) then
PlayerY = PlayerY + WalkingSpeed*Way
else
if BIs[In[math.floor(PlayerY/GridSizeY)+Way .. "," .. math.floor(PlayerY/GridSizeY)] ] ~= 1 then
else
PlayerY = PlayerY + WalkingSpeed*Way
end
end
end
CurrentXPos = PlayerX
CurrentYPos = PlayerY
SetCameraPosition(CurrentXPos, CurrentYPos)
end
for i = -PlayerSight,PlayerSight do
for j = -PlayerSight,PlayerSight do
if In[math.floor(PlayerX/GridSizeX)+i .. "," .. math.floor(PlayerY/GridSizeY)+j] == nil then
AddBlock(math.floor(PlayerX/GridSizeX)+i,math.floor(PlayerY/GridSizeY)+j)
end
local tempBlock = In[math.floor(PlayerX/GridSizeX)+i .. "," .. math.floor(PlayerY/GridSizeY)+j]
if tempBlock ~= nil and BIs[tempBlock] ~= nil and Bx[tempBlock] ~= nil and By[tempBlock] ~= nil then
if BIs[tempBlock] ~= 1 and math.abs(PlayerX-Bx[tempBlock]) < PlayerSight*GridSizeX and math.abs(PlayerY-By[tempBlock]) < PlayerSight*GridSizeY then
DrawBox(1,1,Bx[tempBlock],By[tempBlock],Bx[tempBlock]+GridSizeX,By[tempBlock]+GridSizeY,RedType[BIs[tempBlock]],GreenType[BIs[tempBlock]],BlueType[BIs[tempBlock]],1)
end
end
end
end
DrawSprite(1,PlayerX,PlayerY,1,0,0,1,5)
end
function Initialization()
GridSizeX = GetScreenWidth()/16
GridSizeY = GetScreenHeight()/16
MapDepth = 200
PlayerX = GridSizeX/2
PlayerY = GridSizeY/2
CurrentXPos = PlayerX
CurrentYPos = PlayerY
SetCameraPosition(CurrentXPos, CurrentYPos)
PlayerSight = 3
WalkingSpeed = 0.00001
Limits = true
FreeCam = true
Block = -1
Bx = {}
By = {}
BGravity = {}
BTowerRaze = {}
BIs = {}
In = {}
RedType = {0,127/255,0.33,0.45}
GreenType = {0,70/255,0.33,0.45}
BlueType = {0,0,0.33,0.33}
Br = 10
Bg = 125
Bb = 175
SetBackdropColour(Br,Bg,Bb)
end
function AddBlock(x,y)
Block = Block + 1
Bx[Block] = x*GridSizeX
By[Block] = y*GridSizeY
BGravity[Block] = true
BTowerRaze[Block] = true
In[x .. "," .. y] = Block
FindProperType(Block)
end
function FindProperType(Block)
local h = 1
local randomn = math.random()
if Bx[Block] == 0 and By[Block] == 0 then else
if randomn > 0.7 and h ~= 2 then
h = 2
elseif randomn < 0.7 and randomn > 0.1 then
h = 3
elseif randomn < 0.1 and randomn > 0.05 then
h = 4
end
end
BIs[Block] = h
end
Is there any way of making more than one object? So, like:
A box over here
And then another down here?
And have them both work as you would expect of two independent objects?
DrawCube(200,200,200)
DrawCube(-500,-500,500)
Is there any way to reefer to the WHOLE of an array/matrix? Say I had the array
x = {0,1,2,3,4,5,6,7,8,9}
Can refer to the whole thing at once?
function DrawCube(xpos,ypos,zpos)
-- #### DO NOT REMOVE ####
i = numberofvertices
firstvert = i
-- #### DO NOT REMOVE ####
-- ##### VERTICES #####
-- near-side face
-- #0 top left vertex
vertex3dX[i] = xpos - 50
vertex3dY[i] = ypos - 50
vertex3dZ[i] = zpos - 50
i = i + 1
-- #1 top right vertex
vertex3dX[i] = xpos + 50
vertex3dY[i] = ypos - 50
vertex3dZ[i] = zpos - 50
i = i + 1
-- #2 bottom right vertex
vertex3dX[i] = xpos + 50
vertex3dY[i] = ypos + 50
vertex3dZ[i] = zpos - 50
i = i + 1
-- #3 bottom left vertex
vertex3dX[i] = xpos - 50
vertex3dY[i] = ypos + 50
vertex3dZ[i] = zpos - 50
i = i + 1
-- #4 far-side face
-- top left vertex
vertex3dX[i] = xpos - 50
vertex3dY[i] = ypos - 50
vertex3dZ[i] = zpos + 50
i = i + 1
-- #5 top right vertex
vertex3dX[i] = xpos + 50
vertex3dY[i] = ypos - 50
vertex3dZ[i] = zpos + 50
i = i + 1
-- #6 bottom right vertex
vertex3dX[i] = xpos + 50
vertex3dY[i] = ypos + 50
vertex3dZ[i] = zpos + 50
i = i + 1
-- #7 bottom left vertex
vertex3dX[i] = xpos - 50
vertex3dY[i] = xpos + 50
vertex3dZ[i] = xpos + 50
i = i + 1
-- #### DO NOT REMOVE ####
numberofvertices = i - 1
i = numberofedges
firstedge = i
-- #### DO NOT REMOVE ####
-- ##### EDGES #####
-- edgefrom[i] = ID of the vertice the edge should be drawn FROM
-- edgeto[i] = ID of the vertice the edge should be drawn TO
-- "i" is the ID of the edge.
-- near-side edges
-- #0 from near top left to near top right
edgefrom[i] = firstvert + 0
edgeto[i] = firstvert + 1
i = i + 1
-- #1 from near top right to near bottom right
edgefrom[i] = firstvert + 1
edgeto[i] = firstvert + 2
i = i + 1
-- #2 from near bottom right to near bottom left
edgefrom[i] = firstvert + 2
edgeto[i] = firstvert + 3
i = i + 1
-- #3 from near bottom left to near top top
edgefrom[i] = firstvert + 3
edgeto[i] = firstvert + 0
i = i + 1
-- far side edges
-- #4 from far top left to far top right
edgefrom[i] = firstvert + 4
edgeto[i] = firstvert + 5
i = i + 1
-- #5 from far top right to far bottom right
edgefrom[i] = firstvert + 5
edgeto[i] = firstvert + 6
i = i + 1
-- #6 from far bottom right to far bottom left
edgefrom[i] = firstvert + 6
edgeto[i] = firstvert + 7
i = i + 1
-- #7 from far bottom left to far top right
edgefrom[i] = firstvert + 7
edgeto[i] = firstvert + 4
i = i + 1
-- connecting edges
-- #8 from near top left to far top left
edgefrom[i] = firstvert + 0
edgeto[i] = firstvert + 4
i = i + 1
-- #9 from near top right to far top right
edgefrom[i] = firstvert + 1
edgeto[i] = firstvert + 5
i = i + 1
-- #10 from near bottom right to far bottom right
edgefrom[i] = firstvert + 2
edgeto[i] = firstvert + 6
i = i + 1
-- #11 from near bottom left to far bottom left
edgefrom[i] = firstvert + 3
edgeto[i] = firstvert + 7
i = i + 1
-- #### DO NOT REMOVE ####
numberofedges = i - 1
-- #### DO NOT REMOVE ####
end