NaaLaa
That 3d thing - Printable Version

+- NaaLaa (https://www.naalaa.com/forum)
+-- Forum: NaaLaa (https://www.naalaa.com/forum/forum-1.html)
+--- Forum: NaaLaa 7 Code (https://www.naalaa.com/forum/forum-4.html)
+--- Thread: That 3d thing (/thread-124.html)

Pages: 1 2 3 4 5 6 7 8


RE: That 3d thing - Marcus - 05-25-2024

Here's a new zip with a new step and example added. This is about sub-sectors, heights and jumps, you'll probably need to experiment a lot on your own with this. Ask if anything is unclear Smile

Edit I will write complete api documentation later, of course.

Edit 2 Next up is probably static objects (in sprite and mesh form).


RE: That 3d thing - johnno56 - 05-26-2024

Cool... Leaping works very well... Nice.


RE: That 3d thing - aliensoldier - 05-26-2024

The examples are very cool and it works very well. I have noticed that when you move the camera or move towards the walls, you see a kind of shadow on the walls that is generated or moved and it is somewhat annoying.


RE: That 3d thing - Marcus - 05-26-2024

(05-26-2024, 03:36 PM)aliensoldier Wrote: The examples are very cool and it works very well. I have noticed that when you move the camera or move towards the walls, you see a kind of shadow on the walls that is generated or moved and it is somewhat annoying.

I think you mean the retro fog thing Smile Change the first parameter to EA_Setfog from EA_RETRO to EA_NORMAL.


RE: That 3d thing - aliensoldier - 05-26-2024

Now it is much better. There is another thing that is somewhat annoying to my eyes, objects or walls that are far away cannot be seen because of a dark fog, is there some way to eliminate or reduce that darkness in the background.


RE: That 3d thing - Marcus - 05-27-2024

I had a really busy weekend. Jazz concert (my son) on Saturday and gymnastics competion (daughter) on Sunday. I wrote the code for the next step in the tutorial just now. Here's the proof:

https://naalaa.com/tmp/example_4.mp4

But the text will have to wait until tomorrow.


RE: That 3d thing - johnno56 - 05-27-2024

Awww... Sad


RE: That 3d thing - 1micha.elok - 05-28-2024

(05-27-2024, 06:30 PM)Marcus Wrote: I had a really busy weekend. Jazz concert (my son) on Saturday and gymnastics competion (daughter) on Sunday. ....

You are so lucky to have an awesome family time. Great !!!
By the way, you may reply my question when you are free,  it's not urgent  Big Grin

   
click the image to zoom-in

I'm trying to make a kind of first-person-shooter game, but I believe I do it in a wrong way .... lol
a. Could you please advice me the right-way, where should I put the code of draw image weapon ?
b. And how to put the weapon at the middle of the bottom screen ?
    I can not put it as draw image weapon, width(primary)/2, height(primary) as it will draw out of screen.  

Code:
'---------------
' INITILIZATION
'---------------
include "myassets/enginea.n7"

set window "stargate",320,240,false,2
set redraw off

visible weapon = loadimage("myassets/shooter.png")

EA_SetView(primary, rad(65), 0.1,6)
EA_SetFog(EA_NORMAL, 255,255,255)

flags = EA_LoadMap("myassets/map.json")
player = unset
foreach f in flags
    if f.flag = "player"
        player = EA_FpsPlayer()
        player.SetPos(f.x,f.floorY, f.z)
    endif
next


'------
' MAIN
'------   
EA_AddObject(player)
EA_SetCamera(player)
player.SetMouseSens(0.3)

EA_SetUpdateAction(Update)

EA_Run()


'-----------
' FUNCTIONS
'-----------
function Update(dt)
    draw image weapon, 100,130
    redraw
    fwait 30

    if keydown(KEY_ESCAPE,true) then
        EA_Stop()
    endif
endfunc



RE: That 3d thing - Marcus - 05-28-2024

(05-28-2024, 05:02 AM)1micha.elok Wrote:
(05-27-2024, 06:30 PM)Marcus Wrote: I had a really busy weekend. Jazz concert (my son) on Saturday and gymnastics competion (daughter) on Sunday. ....

You are so lucky to have an awesome family time. Great !!!
By the way, you may reply my question when you are free,  it's not urgent  Big Grin


click the image to zoom-in

I'm trying to make a kind of first-person-shooter game, but I believe I do it in a wrong way .... lol
a. Could you please advice me the right-way, where should I put the code of draw image weapon ?
b. And how to put the weapon at the middle of the bottom screen ?
    I can not put it as draw image weapon, width(primary)/2, height(primary) as it will draw out of screen.  

Code:
'---------------
' INITILIZATION
'---------------
include "myassets/enginea.n7"

set window "stargate",320,240,false,2
set redraw off

visible weapon = loadimage("myassets/shooter.png")

EA_SetView(primary, rad(65), 0.1,6)
EA_SetFog(EA_NORMAL, 255,255,255)

flags = EA_LoadMap("myassets/map.json")
player = unset
foreach f in flags
    if f.flag = "player"
        player = EA_FpsPlayer()
        player.SetPos(f.x,f.floorY, f.z)
    endif
next


'------
' MAIN
'------   
EA_AddObject(player)
EA_SetCamera(player)
player.SetMouseSens(0.3)

EA_SetUpdateAction(Update)

EA_Run()


'-----------
' FUNCTIONS
'-----------
function Update(dt)
    draw image weapon, 100,130
    redraw
    fwait 30

    if keydown(KEY_ESCAPE,true) then
        EA_Stop()
    endif
endfunc

The next step in the tutorial will show you how to do that, as you can see in the video above. But ... I can tell you right now. 

Use EA_SetDrawAction(func) to set a callback function that will be called every frame when the scene has been rendered:

Code:
EA_SetDrawAction(Draw)
...
function Draw()
    set color 255, 255, 255
    draw image gunImage, (width(primary) - width(gunImage))/2, height(primary) - height(gunImage)
endfunc



RE: That 3d thing - Marcus - 05-28-2024

Here's a zip with the fourth tutorial step included. It's about static billboard sprites.