v0.3.
This commit is contained in:
@@ -2,7 +2,6 @@ local pos = { 2, 0.5, 6 }
|
||||
local speed = 5.0
|
||||
local camera = -1
|
||||
local texture = -1
|
||||
local mesh = -1
|
||||
local textureSize = { 256, 96 }
|
||||
local res = { 384, 216 }
|
||||
local winSize = RL_GetWindowSize()
|
||||
@@ -79,7 +78,6 @@ function init()
|
||||
|
||||
texture = RL_LoadTexture( RL_GetBasePath().."../resources/images/tiles.png" )
|
||||
camera = RL_CreateCamera3D()
|
||||
mesh = RL_GenMeshCube( { 1, 2, 1 } )
|
||||
RL_SetCamera3DPosition( camera, pos )
|
||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
|
||||
@@ -24,11 +24,12 @@ function init()
|
||||
local monitor = 0
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
local winSize = RL_GetWindowSize()
|
||||
local winSize = { 1920, 1080 }
|
||||
|
||||
RL_GuiSetFont( 0 )
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowSize( winSize )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
end
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ local tilemap = {
|
||||
|
||||
local player = {
|
||||
vel = Vec2:new( 0, 0 ),
|
||||
pos = Vec2:new( 32, 32 ), -- Center down.
|
||||
pos = Vec2:new( 32, 32 ), -- Center bottom.
|
||||
colRect = { 0, 0, 12, 14 },
|
||||
onFloor = false,
|
||||
frames = {
|
||||
@@ -49,11 +49,6 @@ local player = {
|
||||
facing = 1,
|
||||
}
|
||||
|
||||
local kissa = { Vec2:new( 2, 4 ), 23 }
|
||||
|
||||
-- print( table.concat( kissa ) )
|
||||
print( kissa[1] )
|
||||
|
||||
local function createMap()
|
||||
for x = 1, tilemap.size.x do
|
||||
table.insert( tilemap.tiles, {} )
|
||||
@@ -199,16 +194,6 @@ local function playerMovement( delta )
|
||||
end
|
||||
end
|
||||
|
||||
-- Alternative top down movement.
|
||||
|
||||
-- if RL_IsKeyDown( KEY_DOWN ) then
|
||||
-- player.vel.y = player.vel.y + PLAYER_ACCELL * delta
|
||||
-- moving[2] = true
|
||||
-- elseif RL_IsKeyDown( KEY_UP ) then
|
||||
-- player.vel.y = player.vel.y - PLAYER_ACCELL * delta
|
||||
-- moving[2] = true
|
||||
-- end
|
||||
|
||||
if RL_IsKeyPressed( KEY_SPACE ) and player.onFloor then
|
||||
player.vel.y = -JUMP_STR
|
||||
player.onFloor = false
|
||||
@@ -226,18 +211,7 @@ local function playerMovement( delta )
|
||||
end
|
||||
end
|
||||
|
||||
-- if not moving[2] then
|
||||
-- if delta * PLAYER_DEACCELL < player.vel.y then
|
||||
-- player.vel.y = player.vel.y - PLAYER_DEACCELL * delta
|
||||
-- elseif player.vel.y < -delta * PLAYER_DEACCELL then
|
||||
-- player.vel.y = player.vel.y + PLAYER_DEACCELL * delta
|
||||
-- else
|
||||
-- player.vel.y = 0.0
|
||||
-- end
|
||||
-- end
|
||||
|
||||
player.vel.x = util.clamp( player.vel.x, -PLAYER_MAXSPEED, PLAYER_MAXSPEED )
|
||||
-- player.vel.y = util.clamp( player.vel.y, -PLAYER_MAXSPEED, PLAYER_MAXSPEED )
|
||||
|
||||
player.vel.y = player.vel.y + GRAVITY * delta
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ function init()
|
||||
RL_SetCameraMode( camera, CAMERA_FREE )
|
||||
|
||||
calcNormal( tri )
|
||||
|
||||
texture = RL_LoadTexture( RL_GetBasePath().."../resources/images/tile.png" )
|
||||
end
|
||||
|
||||
local function checkCollisionPointTriangle( p, a, b, c, n )
|
||||
|
||||
Reference in New Issue
Block a user