Hey everybody!
I'm experimenting a little with a 2D Isometric tile engine. I know, DBP is a 3D Engine, but it works surprisingly well!
I got placement and "camera" (Tile) movement covered but I cannot seem to be able to make it rotate.
Here is the array for each tile:
global tile_image_nr as integer
// Output Strings
// Console Media Array
type t_tile
sprite_nr as integer
px as integer
py as integer
endtype
// File Array (Made from Type)
dim tile(0) as t_tile
empty array tile(0)
This is the code I use to move and rotate the camera (tiles). Movement, no problem but I have no clue on how to get the new x,y positions for rotation.
function tiles_upd()
for ID = 0 to array count(tile(0))
paste sprite tile(ID).sprite_nr, tile(ID).px, tile(ID).py
next ID
// Camera Up
if keystate(200) = 1
for ID = 0 to array count(tile(0))
tile(ID).py = tile(ID).py + 5
next ID
endif
// Camera Down
if keystate(208) = 1
for ID = 0 to array count(tile(0))
tile(ID).py = tile(ID).py - 5
next ID
endif
// Camera Left
if keystate(203) = 1
for ID = 0 to array count(tile(0))
tile(ID).px = tile(ID).px + 5
next ID
endif
// Camera Right
if keystate(205) = 1
for ID = 0 to array count(tile(0))
tile(ID).px = tile(ID).px - 5
next ID
endif
// Rotate Left
if keystate(51) = 1
for ID = 0 to array count(tile(0))
// ????
next ID
endif
// Rotate Right
if keystate(52) = 1
for ID = 0 to array count(tile(0))
// ????
next ID
endif
endfunction
I know, besides placement the tiles needs to be "rotated", but I got that covered. Just need help with getting the new positions for rotation.
So any help is much appreciated! Thanks!
Regards Sph!nx