This is telling you that the function plrupdate
wasn't defined at the time when you tried to use it. Beyond that, you haven't provided enough information for anyone else to do anything about this.
That said, I would recommend against yelling at a forum to solve problems in the bugs category. The vast majority of errors are specific to the code that generated them, even when it doesn't seem like it. Furthermore, it's normal for any game project to run into hundreds of errors during development.
More Details? How To Solve?
BTW, Here Is Code:
TAB 0:
--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 1:
--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 2:
--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
I see plrupdate is called on in _update, but no definition before that. EX:
function plrupdate() -- do something end |
In addition to not having a plrupdate() function as @Verb pointed out, you also haven't defined plranimate(), which you call immediately after - that's also going to fail if you don't create a plranimate() function.
It looks like you're following the Nerdy Teachers platformer tutorial ( https://nerdyteachers.com/Explain/Platformer/ ).
The problem you're getting is addressed a couple minutes into the 5th video in the series, when they define what they call the player_update() function: https://youtu.be/GTpd8Lb9CX0 . And, as @2bitchuck pointed out you're going to run into another problem if you try to run before they define the player_animate() function.
Generally, when you run into a problem with following a tutorial, it's helpful to include that info when you ask a question (also usually helpful to finish a section in the tutorial before assuming things are wrong--they might just still be incomplete).
[Please log in to post a comment]