Posted: 21st Nov 2011 0:29
all the files you nead is here!


I roughly cut pieces out of my raycaster so there could be some buggs


Edited.............................

Ok!
I have made 2 versions now of the get pixel function.

They explain them self!

+ Code Snippet
////////////////////////////////
// used to get pixel on floor //
////////////////////////////////
function Get_Pixel_Centered( x as integer , y as integer , Scale as integer )
    // converts it to an grid grid nr
    X1 = (x+1) / (Scale)
    Y1 = (y+1) / (Scale)
    // converts it to an world position
    X2 = ( X1 * ( Scale ) )
    Y2 = ( Y1 * ( Scale ) )
    // here do we get an pixel cord inside that tile
    X3 =  ( x - X2 ) 
    Y3 =  ( y - Y2 ) 
    // Calculate it to an sprite frame
    if X3 < Y3 then result = ( X3 + ( Y3 * ( Scale + 1 ) ) ) - ( Scale + 1 )
    if X3 > Y3 then result = ( Y3 + ( X3 * ( Scale + 1 ) ) ) - ( Scale + 1 )
ENDFUNCTION result

function Get_Pixel_Grid( x as integer , y as integer , Scale as integer )
    // converts it to an grid grid nr
    x=x+(Scale/2)
    y=y+(Scale/2)
    X1=x/Scale
    Y1=y/Scale
    // converts it to an world position
    X2=(X1*(Scale))-(Scale/2)
    Y2=(Y1*(Scale))-(Scale/2)

    // here do we get an pixel cord inside that tile
    X3=( (x-X2) - (Scale/2) )
    Y3=( (y-Y2) - (Scale/2) )

    // Calculate it to an sprite frame
    if X3 < Y3 then result = ( X3 + ( Y3 * ( Scale + 1 ) ) ) - ( Scale + 1 )
    if X3 > Y3 then result = ( Y3 + ( X3 * ( Scale + 1 ) ) ) - ( Scale + 1 )
ENDFUNCTION result
Posted: 21st Nov 2011 2:53
Nice! I will check this out and report back! I like all your 3d work so far. it boggles my mind, but I like it.
Posted: 21st Nov 2011 11:19


Nice.
Posted: 21st Nov 2011 16:55
Nice! I will check this out and report back! I like all your 3d work so far. it boggles my mind, but I like it.

Nice.


Thanks!
I will try to add small snippets on how you add other colours and textures later on .
also how yoy raise the ground for hills and stuff.

Also pay attention on this command !
RENDER_Ground( LowRes , MinPixel , Floor_Step# , View_Depth)
These 2 affect how the texture looks and performance
Low res is the number of lines it skips when drawing.
Floor_Step# is the distance the ray travels before checking the ground.

Min pixel is supposed to skip lines under this size but i seam to have removed it when moving the files to the snippet
Now back to the raycaster that bothers me with alot of problems