05-25-2024, 11:51 AM (This post was last modified: 05-25-2024, 12:35 PM by Marcus.)
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
Edit I will write complete api documentation later, of course.
Edit 2 Next up is probably static objects (in sprite and mesh form).
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.
(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 Change the first parameter to EA_Setfog from EA_RETRO to EA_NORMAL.
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.
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:
(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
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
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
05-28-2024, 05:14 AM (This post was last modified: 05-28-2024, 07:43 AM by Marcus.)
(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
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
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