npc walks in a direction unintentionally

Post here for help and support regarding LunaLua and SMBX2's libraries and features.

Moderator: Userbase Moderators

Gabriel_2004
Cheep-Cheep
Cheep-Cheep
Posts: 10
Joined: Sat Feb 20, 2021 11:04 am
Pronouns: he/him

npc walks in a direction unintentionally

Postby Gabriel_2004 » Fri Mar 05, 2021 5:48 pm

Hello, the custom npc I'm doing has a small problem that I don't know how to solve, it was supposed to move back and forth, without having to change the v.direction (similar to birdo) using a timer as a reference, but even though I put the code below, it only walks in one direction, if someone could help me I would be grateful
Spoiler: show
if player.x < v.x then
v.direction = -1
elseif player.x > v.x then
v.direction = 1
end

if data.shoottimer > 80 then
v.speedX = v.direction * 0.65
elseif data.shoottimer < 80 then
v.speedX = -v.direction * 0.65
end

MrDoubleA
Edward
Edward
Posts: 394
Joined: Mon Aug 20, 2018 7:02 am
Flair: How much munchers?

Re: npc walks in a direction unintentionally

Postby MrDoubleA » Sat Mar 06, 2021 2:55 pm

NPC's will always look in the direction that they're moving in, unless you set "staticdirection = true," along with all the other config settings.


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari