# LoveCode, a makecode-like api for Lua

**URL:** <https://forum.makecode.com/t/lovecode-a-makecode-like-api-for-lua/31031>\
**Category:** Arcade\
**Created:** [October 7, 2024, 2:33am UTC](https://forum.makecode.com/t/lovecode-a-makecode-like-api-for-lua/31031 "2024-10-07T02:33:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jedi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jedi/32/14307_2.png) [@Jedi](https://forum.makecode.com/u/Jedi)\
**Post date:** [October 7, 2024, 2:33am UTC](https://forum.makecode.com/t/lovecode-a-makecode-like-api-for-lua/31031/1 "2024-10-07T02:33:52Z")

</div>

_ **YEE** _  
Hi! im working on (yes, its nowhere near finished) a lua port for makecode using love2d, i made it to help people get more familiar to non-block coding while still having a somewhat block like system so you can maybe learn javascript/python easier (python is very simmilar to lua BTW)

_ **SOME DIFFERENCES:** _

- no limitations with graphics, sound, performance, input, etc
- not block coding (duh)
- there is no built in editor, o you must use a code editor such as vscode, a sprite editor such as aseprite, and a song editor such as beepbox.
- there are quite a bit of features missing due to it being a WIP, so you can only do simple things such as input, sprite defining, moving, displaying, so no collision, tilemaps, or sound yet (unless you want to code your own not with a mc api)
- its not in your browser (duh again)
- it updates at 60FPS instead of 30

also, i dont have a documentation built up yet, bc thats also a WIP 😅

if you have any questions, comments, or just wanna know how to use this, please let me know!

![LOVECODE](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/8/0/805845c4cb95911405fa5f5d44c2dada29627ae1.gif)

> **[GitHub - ShrimpCatDev/LoveCode: An implementation of Makecode Arcade in LÖVE](https://github.com/ShrimpCatDev/LoveCode)**
>
> An implementation of Makecode Arcade in LÖVE

---

<div class="post-metadata">

**Author:** ![randomuser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/randomuser/32/32505_2.png) [@randomuser](https://forum.makecode.com/u/randomuser)\
**Post date:** [October 7, 2024, 2:56pm UTC](https://forum.makecode.com/t/lovecode-a-makecode-like-api-for-lua/31031/2 "2024-10-07T14:56:37Z")

</div>

Cool! :0

---

<div class="post-metadata">

**Author:** ![Astro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/astro/32/35479_2.png) [@Astro](https://forum.makecode.com/u/Astro)\
**Post date:** [October 7, 2024, 4:47pm UTC](https://forum.makecode.com/t/lovecode-a-makecode-like-api-for-lua/31031/3 "2024-10-07T16:47:29Z")

</div>

Wow, Impressive.

---

<div class="post-metadata">

**Author:** ![Jedi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jedi/32/14307_2.png) [@Jedi](https://forum.makecode.com/u/Jedi)\
**Post date:** [November 1, 2024, 2:40am UTC](https://forum.makecode.com/t/lovecode-a-makecode-like-api-for-lua/31031/4 "2024-11-01T02:40:31Z")

</div>

![2024-10-31 20-54-02.mkv [video-to-gif output image]](https://s6.ezgif.com/tmp/ezgif-6-8c2d78d062.gif)  
Working on collisions!  
Expect an update soon! (as long as I don’t get stuck and/or distracted 😅)

---

<div class="post-metadata">

**Author:** ![Jedi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jedi/32/14307_2.png) [@Jedi](https://forum.makecode.com/u/Jedi)\
**Post date:** [November 1, 2024, 2:48pm UTC](https://forum.makecode.com/t/lovecode-a-makecode-like-api-for-lua/31031/5 "2024-11-01T14:48:28Z")

</div>

aw man i didnt upload the gif right i used the link to the gif converter instead of actually uploading the gif 😭

---

<div class="post-metadata">

**Author:** ![Jedi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jedi/32/14307_2.png) [@Jedi](https://forum.makecode.com/u/Jedi)\
**Post date:** [November 7, 2024, 5:06pm UTC](https://forum.makecode.com/t/lovecode-a-makecode-like-api-for-lua/31031/6 "2024-11-07T17:06:47Z")

</div>

Just wondering, would anyone actually use this? (i doubt)

_Poll ([view on site](https://forum.makecode.com/t/lovecode-a-makecode-like-api-for-lua/31031/6))_

---

<div class="post-metadata">

**Author:** ![Jedi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jedi/32/14307_2.png) [@Jedi](https://forum.makecode.com/u/Jedi)\
**Post date:** [November 11, 2024, 2:31pm UTC](https://forum.makecode.com/t/lovecode-a-makecode-like-api-for-lua/31031/7 "2024-11-11T14:31:19Z")

</div>

**yay heres a tutorial for those who wanna try!**

_REQUIRMENTS:_

- love2d ([https://love2d.org/](https://love2d.org/) pls get the portable version)
- tiled ([https://www.mapeditor.org/](https://www.mapeditor.org/))
- some pixel art editor of your choice (if you want to use pixel art)
- a text/code editor (i use vscode)

so lets first lets get some assets to use, im going to use [https://opengameart.org/content/a-platformer-in-the-forest](https://opengameart.org/content/a-platformer-in-the-forest) for my tilemap and ill just provide the lil log guy for the player (i havent implemented animations quite yet)

go to LoveCode’s project page on github and download it.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/6/5/650234182f24e282df34ca4736967a68be7b6b93.png)

once lovecode is downloaded, extract the zip. now go into the folder and make sure these files are at the top of it

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/0/d/0d5c1daf73e828d97cdb12fb462a2251d3ff462a.png)

now, to see if everything is right, drag and drop that folder onto your love program (love.exe for windows, love.appimage for linux)  
it should look something like this when it opens:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/1/8/18202fd3e7750a2d2a6f5890b9ef0480a3e41a08.png)

if it does, great! now we can move on.

now, download this image  
 ![player](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/b/4/b47630a6ced2c29517edaffeca81c0eeff7bf6c5.png)  
and move it to assets/sprites in your lovecode folder.

next, lets go into our code.lua file in your code/text editor  
it should look like this

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/5/7/57b20faa8f0308ce34fbeadd6c503443ac65236f.png)  
now there is some premade code in there so lets get rid of that so we can use our own code!  
it should look like this once your done:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/e/0/e0c6acd4c50ee6d0cc98f1f4aca933649881ba4f.png)

now that we have a blank game, we can actually make it!  
so first, we will make a new sprite called `player` in the function `gameStart()`

```lua
player={} --creates a new table, or blank sprite that is worthless
newSprite(player, "assets/sprites/player.png", "player") --we give it some worth

```

so it should look like this

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/f/9/f92513450a6b7019d4637b92cb97c174f815aa8b.png)

now run your code.  
OH NO!!! THERE IS JUST A BLANK SCREEN WITH NO PLAYER!!!  
don’t worry, we just need to add two pieces of code to do that!  
simply add `updateSprites(player)` to `gameUpdate()` and `drawSprites(player)` to `gameDraw()` so it looks like this:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/7/a/7ac23bda4092f513324cab5b1961a807b8105fc5.png)

now run your code to see your player on the screen!

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/d/d/dd046ef34d2c00b7752f206565f7afe8b1e85a21.jpeg)

now i dont know about you, but i think this game looks a little boring, so ill show you how to do more with it in the next post!

(sorry if this makes no sense, i wrote this up really fast and im tired.)
