Log In  

THIS GAME NEEDS MORE FIXES!!!

P#139347 2023-12-29 13:24

1

Again, if you don't post code, no one can help you.

P#139350 2023-12-29 13:56

Tab Einz

--unnamed game--
--by elidavididi

--starts game
function _init()
--oh no! tables!
 plr={
  sprite=1,
  x=12,
  y=72,
  w=8,
  h=8,
  flp=false,
  deltax=2,
  deltay=3,
  acc=0.5,
  anim=0,
  running=false,
  crouching=false,
  jumping=false,
  falling=false,
  landed=false,
 }

 gravity=0.3
 friction=0.85
end

Tab Zwei:

--updates and draws

--handles the game logic
function _update()
    plrupdate()
    plranimate()
end

--handles the gfx
function _draw()
 cls(12)
 map()
 spr(plr.sprite,plr.x,plr.y,1,1,plr.flp)
end

Tab Trei:

--colliders

function collidemap(obj,aim,flag)
    --obj's table need x,y,w and h.
    --and aim needs all 4 directions in english.
    local x=obj.x   local y=obj.y
    local w=obj.w   local h=obj.h

    --get ready to do math, were going down the rabbit hole.
    local x1=0 local y1=0
 local x2=0 local y2=0

 if aim== "left" then
  x1=x-1 y1=y
  x2=x   y2=y+h-1

 elseif aim== "right" then
  x1=x+w y1=y
  x2=x+w+1   y2=y+h-1

 elseif aim== "up" then
    x1=x+1 y1=y-1
  x2=x+w-1   y2=y

 elseif aim== "down" then
  x1=x y1=y+h
  x2=x+w   y2=y+h

 end

 --the m/fget turns every 8 pixels to 1 tile.
 x1=x1/8 y1=y1/8
 x2=x2/8 y2=y2/8

 if fget(mget(x1,y1), flag)
 or fget(mget(x1,x2), flag)
 or fget(mget(x2,y1), flag)
 or fget(mget(x2,y2), flag) then
  return true
 else
  return false
 end   
end

Tab Vier:

--player cordinations

function plrupdate()
    --physics time!
    player.deltay+=gravity
    player.deltax*=friction
end
P#139355 2023-12-29 15:32 ( Edited 2023-12-29 15:32)
1

plrupdate() is trying to update the values of a table called 'player', the table is called 'plr'.

P#139361 2023-12-29 15:48

[Please log in to post a comment]