Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
That 3d thing
#41
(05-28-2024, 05:58 PM)Marcus Wrote: Here's a zip with the fourth tutorial step included. It's about static billboard sprites.

Question on Example 4
By the way, you may reply when you are free, it's not urgent  Big Grin

   
click the image to zoom-in

Please zoom-in the attached image :
1. On the EngineA Map Editor, I repositioned the player to (4,15).
    When I  ran the code, the player was facing the south wall.
    How to make him facing to the north room ?

2. What function should I write on the code editor so that I can display player's information :
    a. player's coordinates / position (x,y,z)
    b. player's angle (in degree/radian) so that I can turn him to face the north room. 

Thank you.
Reply
#42
(Yesterday, 04:55 AM)1micha.elok Wrote:
(05-28-2024, 05:58 PM)Marcus Wrote: Here's a zip with the fourth tutorial step included. It's about static billboard sprites.

Question on Example 4
By the way, you may reply when you are free, it's not urgent  Big Grin


click the image to zoom-in

Please zoom-in the attached image :
1. On the EngineA Map Editor, I repositioned the player to (4,15).
    When I  ran the code, the player was facing the south wall.
    How to make him facing to the north room ?

2. What function should I write on the code editor so that I can display player's information :
    a. player's coordinates / position (x,y,z)
    b. player's angle (in degree/radian) so that I can turn him to face the north room. 

Thank you.

The coordinate system in the engine and s3d is a bit wonky. The z axis points into the screen, the x axis right and the y axis down. In the editor's top down view, on the other hand, the x axis points right and the z axis down. That's why a map seems mirrored when you walk through it in a game.

You can use player.SetYaw(radians) to change the player's direction in the xz plane. At the angle 0 radians, which is default, the player is looking down (in the editor's top down view). This is because I use sin(angle) (0) for the x direction and cos(angle) (1) for the z direction. So to make the player look up (in the editor's coordinate system ...), use player.SetYaw(rad(180)) or player.SetYaw(PI). You could even set the starting angle as "value" in the "player" flag (more about that when we look at enemies, which comes next).


You can read the player's position using the X, Y and Z functions. In your Draw function:

Code:
set caret 0, 0
wln "Position: " + player.X() + ", " + player.Y() + ", " + player.Z()

You have to declare the player variable visible for that to work.

I should have decided to let the x axis in the editor represent the 3d z axis and the y axis be the 3d x axis. Then the map wouldn't appear as mirrored when you walk through it. Maybe I will make that change at some point ...
Reply
#43
(Yesterday, 05:33 AM)Marcus Wrote: ...
a map seems mirrored when you walk through it in a game.
...

Don't worry, though the map seems mirrored compared to EngineA Map Editor when we walk through it in a game,
I could make an adjustment on the game's compass and map ...

Starting Point
Player is facing to the North as it's shown on the Compass.
Player's position on the map (4,0,6) 
   
click the image to zoom-in

Move To The Left
Player is moving to the left as it's shown on the Compass.
Player's position on the map (9,0,2)
   
click the image to zoom-in

Move to The Right
Player is moving to the right as it's shown on the Compass.
Player's position on the map (2,0,2)
   
click the image to zoom-in

Big Grin Big Grin Big Grin
Reply
#44
Ah, a hitscan weapon Smile I haven't even tried implementing the collision testing required for that. But I'll come up with something.
Reply
#45
Can I really write a tutorial step for creating super intelligent and beautiful enemies like these in 45 minutes? You'll know, in 45 minutes. If there's no new post today, there'll be one tomorrow Smile

https://naalaa.com/tmp/example_5.mp4
Reply
#46
Here you go, tutorial step 5, about really simple moving sprites.

It's all about the code this time. There's not many new lines of code, but understanding them can be tricky, so don't be afraid to ask questions.


Attached Files
.zip   ea_tutorial.zip (Size: 3.56 MB / Downloads: 5)
Reply
#47
I had a few minutes to spare... I figured if you are going to go with "Jack-o-lanterns"... Moo Ha Ha Ha...

   

Will not be offended if not used... Just a bit of fun...

J
Logic is the beginning of wisdom.
Reply
#48
(10 hours ago)johnno56 Wrote: I had a few minutes to spare... I figured if you are going to go with "Jack-o-lanterns"... Moo Ha Ha Ha...



Will not be offended if not used... Just a bit of fun...

J

Much better! Maybe his mouth and eyes could light up like that right before he shoots a fire ball at the player? Yes, I'll let that be the sixth step/example. I was s bit unsure about what to do next. I was thinking about sprites with visual directions (like the enemies in wolfenstein 3d), but that can wait. Enemy and player bullets are more interesting.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)