Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(7 edits)

Hello Jerzy. I saw your post on pseudo3d https://devforum.play.date/t/struggling-with-pseudo3d-racing-game-engine/12801/2... and it was very useful to me. Your progress was incredible. 

I don't know if you've done the hills but I wanted to share the technique I was taught to get there if you don't mind.

First, in the update (very important), I initialize a variable which has the value of the screen height, like maxy=screenheight.

Then I add the hills to the roads list like:

road={

  {ct=50,tu=0,bgl=bg_tree,bgr=bg_tree, hill=0},

  {ct=30,tu=-0.1,bgl=bg_tree,bgr,bgr=bg_turn_sign, hill=.05},

  {ct=30,tu=0, hill=-.09},...

Apparently, the values that give a better result are between -0.1 and 0.1.

In the drawscreen() function, I add a variable which will serve as the value of the yd variable:

-- direction
local camang, camyd=
camz*road[camcnr].tu, camz*road[camcnr].hill;
local xd,yd,zd = -camang, -camyd, 1;

Then I draw under one condition:

if(py<maxy) then

maxy=py

drawroad()

addbgsprite()

end

I add the calculation of the hill:

xd=xd+road[cnr].tu;
yd=yd+road[cnr].hill;

I did this under love2d so I made slight modifications in the drawroad() function : 

I deleted the line :

if(math.floor(y2)<math.ceil(y1))then return end

and :

rectangle(0,math.ceil(y1),screenwidth, (y1-y2)) becomes rectangle(0,(y2),screenwidth, (y1-y2))

I hope this will be useful to you as it was to me.

Ps: how did you fix the behavior of the npc ?

And your works are very amazing ! Keep it up and all my thoughts for Kebab.