GeKStudios [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=61130 Help with diagonal movement. <h1>I'm new to Pico 8</h1> <p> <table><tr><td> <a href="/bbs/?pid=145210#p"> <img src="/bbs/thumbs/pico8_gekwalking748neworange-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=145210#p"> GeK Walking Test (WIP) 0.2b</a><br><br> by <a href="/bbs/?uid=61130"> GeKStudios</a> <br><br><br> <a href="/bbs/?pid=145210#p"> [Click to Play]</a> </td></tr></table> <br /> I've been developing this simple game as a first project where you play as &quot;GeK&quot; a simple character that has animations when walking around, however i've found that when moving diagonally it makes the character faster than usual. This issue is very confusing to me and I know it has something to do with the Pythagorean theorem, and I need something called a &quot;movement vector&quot; My code is simple as it has a variable known as speed that is set to 1 and is used when pressing a direction to move by 1 pixel. The character also has a hat and tail that follows it and is supposed to be locked on at all times.<br /> I'd really appreciate it if anyone knows the solution to my problem.<br /> Here's my code if it helps with anything:</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre> function _init() -- setting up variables ismoving = false mainxposition = 63 mainyposition = 63 hatxoffset = 0 hatyoffset = -8 tailxoffset = 8 tailyoffset = 0 walkcycle = 1 animtime = 0 animspeed = 3 tailanim = 2 directionx = &quot;left&quot; directiony = &quot;up&quot; hatanim=18 uptailx=0 uptaily=0 uptailanim=0 uptailxoffset=0 uptailyoffset=8 upand=false downand=false speed=1 end function _update() -- player movement ismoving = false if btn(➡️) or btn(⬅️) then uptailanim=0 ismoving = true animtime += 1 if animtime &gt; animspeed and directionx==&quot;right&quot; and not upand then animtime = 0 walkcycle = walkcycle == 3 and 4 or 3 end if animtime &gt; animspeed and directionx==&quot;right&quot; and not upand then animtime = 0 walkcycle = walkcycle == 3 and 4 or 3 end if animtime &gt; animspeed and directionx==&quot;left&quot; and not upand then animtime = 0 walkcycle = walkcycle == 19 and 20 or 19 end end if btn(⬆️) or btn(⬇️) then ismoving = true tailanim=0 uptailanim=37 animtime += 1 if animtime &gt; animspeed and directiony==&quot;up&quot; then animtime = 0 walkcycle = walkcycle == 35 and 36 or 35 end if animtime &gt; animspeed and directiony==&quot;down&quot; then animtime = 0 walkcycle = walkcycle == 51 and 52 or 51 end end if btn(➡️) then mx=1 hatanim=34 directionx = &quot;right&quot; tailanim = 5 mainxposition += speed end if btn(⬅️) then mx=-1 hatanim=18 directionx = &quot;left&quot; tailanim = 2 mainxposition -= speed end if btn(⬆️) then my=-1 directiony=&quot;up&quot; mainyposition -= speed if directionx==&quot;right&quot; then hatanim=34 end if directionx==&quot;left&quot; then hatanim=18 end end if btn(⬇️) then my=1 directiony=&quot;down&quot; mainyposition += speed uptailanim=0 end --talk-- if btn(❎) then walkcycle=17 end if btn(❎) and directiony==&quot;up&quot; then walkcycle=49 end --update hat position-- hatxposition = mainxposition + hatxoffset hatyposition = mainyposition + hatyoffset -- adjust tail position based on direction-- if directionx == &quot;left&quot; then tailxposition = mainxposition + tailxoffset else tailxposition = mainxposition - tailxoffset end tailyposition = mainyposition + tailyoffset if directiony == &quot;up&quot; then uptailx= mainxposition + uptailxoffset uptaily= mainyposition + uptailyoffset else uptailx = mainxposition - uptailxoffset end tailyposition = mainyposition + tailyoffset --checking moving for animation-- if not ismoving and not btn(❎) then walkcycle = 1 upand=false end if btn(⬇️) and directionx==&quot;right&quot; then hatanim=22 end if btn(⬇️) and directionx==&quot;left&quot; then hatanim=21 end if btn(⬆️) and btn (➡️) or btn(⬆️) and btn(⬅️) then tailanim=0 upand=true else upand=false end if btn(⬇️) and btn (➡️) or btn(⬇️) and btn(⬅️) then tailanim=0 downand=true else downand=false end if btn(⬆️) and btn (➡️) and ismoving then uptailanim=38 end if btn(⬆️) and btn (⬅️) and ismoving then uptailanim=37 end if not ismoving and not btn(❎) and uptailanim==37 then walkcycle = 33 end end function _draw() -- draw sprites-- cls() spr(walkcycle, mainxposition, mainyposition) spr(hatanim, hatxposition, hatyposition) spr(tailanim, tailxposition, tailyposition) spr(uptailanim,uptailx,uptaily) end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> https://www.lexaloffle.com/bbs/?tid=141329 https://www.lexaloffle.com/bbs/?tid=141329 Mon, 01 Apr 2024 01:19:30 UTC GeK Walking Test (WIP) 0.3 <h1>Hi! I am new here</h1> <p>I just barely bought Pico 8 and used some tutorials online to make this simple animated &quot;GeK&quot;<br /> If anyone has any tips or just criticism for beginners like me, I'd very much appreciate it.<br /> (I have had experience with html and JavaScript before) </p> <h1>0.3 finally released</h1> <p> <table><tr><td> <a href="/bbs/?pid=145210#p"> <img src="/bbs/thumbs/pico8_gekwalking748neworangesound-1.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=145210#p"> GeK Walking Test (WIP) 0.3</a><br><br> by <a href="/bbs/?uid=61130"> GeKStudios</a> <br><br><br> <a href="/bbs/?pid=145210#p"> [Click to Play]</a> </td></tr></table> <br /> Controls are simple: Arrows move GeK and X makes him &quot;speak&quot;</p> <h1>This is 0.2</h1> <p> <table><tr><td> <a href="/bbs/?pid=145210#p"> <img src="/bbs/thumbs/pico8_gekwalking748neworange-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=145210#p"> GeK Walking Test (WIP) 0.2b</a><br><br> by <a href="/bbs/?uid=61130"> GeKStudios</a> <br><br><br> <a href="/bbs/?pid=145210#p"> [Click to Play]</a> </td></tr></table> </p> <h1>Here's the version I started with (Also known as 0.1)</h1> <p> <table><tr><td> <a href="/bbs/?pid=145210#p"> <img src="/bbs/thumbs/pico8_gekwalking748-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=145210#p"> GeK Walking Test (WIP) 0.1</a><br><br> by <a href="/bbs/?uid=61130"> GeKStudios</a> <br><br><br> <a href="/bbs/?pid=145210#p"> [Click to Play]</a> </td></tr></table> </p> https://www.lexaloffle.com/bbs/?tid=141298 https://www.lexaloffle.com/bbs/?tid=141298 Sun, 31 Mar 2024 04:34:10 UTC New to Pico 8 (kinda) <p>Hello I am GeK and I am wondering if anyone could share me some good games since I am new here and I dont how to find some good games so this is the only way I know of Thanks!</p> https://www.lexaloffle.com/bbs/?tid=46146 https://www.lexaloffle.com/bbs/?tid=46146 Wed, 12 Jan 2022 23:20:08 UTC