Homebrew [Release] - LövePotion - LÖVE API for 3DS Homebrew - BETA

sweis12

Well-Known Member
Member
Joined
Oct 20, 2013
Messages
1,248
Trophies
0
Age
32
XP
1,368
Country
Saint Kitts and Nevis
It needs something after the string you're printing..

for example.
Code:
function love.draw()
    love.graphics.print("Hello World", 20, 20)
end
will print Hello World on the bottom screen 20 pixels in from the side and 20 pixels down from the top.

Not related to your problem...

But @VideahGams i noticed (don't know if it's just me) but when an error gets thrown like that and it says press start to quit, start doesn't quit...so it won't exit and you have to power off.
Thanks for the help.
Also, that happens for me too. Its quite annoying.
 

sweis12

Well-Known Member
Member
Joined
Oct 20, 2013
Messages
1,248
Trophies
0
Age
32
XP
1,368
Country
Saint Kitts and Nevis
Alright, can someone please tell me why this isn't drawing anything on screen? Its supposed to be the start of a shoot 'em up. All I get is a black screen.
Code:
function love.load()
     player = {}
     player.x = 400
     player.y = 220
     player.bullets = {}
     player.cooldown = 20
     player.speed = 10
     player.fire = function()
         if player.cooldown <= 0 then
            bullet = {}
            player.cooldown = 20
            bullet.x = player.x + 22.5
            bullet.y = player.y
            table.insert(player.bullets, bullet)
         end
     end
end

function love.update(dt)
    player.cooldown = player.cooldown - 1
    if love.keyboard.isDown("right") then
        player.x = player.x + player.speed
    elseif love.keyboard.isDown("left") then
        player.x = player.x - player.speed
    end
 
    if love.keyboard.isDown("a") then
        player.fire()
    end
 
    for i,b in ipairs(player.bullets) do
        if b.y < -10 then
        table.remove(player.bullets, i)
        b.y = b.y - 10
        end
    end
end


function love.draw()
    love.graphics.setScreen('top')
        love.graphics.setColor(0, 0, 255)
        love.graphics.rectangle("fill", player.x, player.y, 40, 10)
        love.graphics.setColor(255, 255, 255)
        for _,b in pairs(player.bullets) do
         love.graphics.rectangle("fill", b.x, b.y, 5, 5)
        end

end


-- Allows the user to return to hbm

function love.keypressed(key)
    if key == 'start' then
        love.event.quit()
    end
end
 
Last edited by sweis12,

Jwiz33

Banned
Joined
Jun 5, 2014
Messages
2,654
Trophies
0
Location
in the illuminati headquar—I have said too much!
Website
iwillcleanyourbasement.webstarts.com
XP
1,492
Country
United States
Alright, can someone please tell me why this isn't drawing anything on screen? Its supposed to be the start of a shoot 'em up. All I get is a black screen.
Code:
function love.load()
     player = {}
     player.x = 400
     player.y = 220
     player.bullets = {}
     player.cooldown = 20
     player.speed = 10
     player.fire = function()
         if player.cooldown <= 0 then
            bullet = {}
            player.cooldown = 20
            bullet.x = player.x + 22.5
            bullet.y = player.y
            table.insert(player.bullets, bullet)
         end
     end
end

function love.update(dt)
    player.cooldown = player.cooldown - 1
    if love.keyboard.isDown("right") then
        player.x = player.x + player.speed
    elseif love.keyboard.isDown("left") then
        player.x = player.x - player.speed
    end

    if love.keyboard.isDown("a") then
        player.fire()
    end

    for i,b in ipairs(player.bullets) do
        if b.y < -10 then
        table.remove(player.bullets, i)
        b.y = b.y - 10
        end
    end
end


function love.draw()
    love.graphics.setScreen('top')
        love.graphics.setColor(0, 0, 255)
        love.graphics.rectangle("fill", player.x, player.y, 40, 10)
        love.graphics.setColor(255, 255, 255)
        for _,b in pairs(player.bullets) do
         love.graphics.rectangle("fill", b.x, b.y, 5, 5)
        end

end


-- Allows the user to return to hbm

function love.keypressed(key)
    if key == 'start' then
        love.event.quit()
    end
end
Pretty sure the player is being spawned outside the boundaries.
 

VideahGams

Well-Known Member
OP
Newcomer
Joined
Aug 29, 2015
Messages
91
Trophies
0
Age
25
Location
Glasgow, Scotland
Website
videah.xyz
XP
146
Country
But @VideahGams i noticed (don't know if it's just me) but when an error gets thrown like that and it says press start to quit, start doesn't quit...so it won't exit and you have to power off.

Yeah, this is fixed in the GitHub repo, I'll be cleaning it up and putting out a new release shortly
 

VideahGams

Well-Known Member
OP
Newcomer
Joined
Aug 29, 2015
Messages
91
Trophies
0
Age
25
Location
Glasgow, Scotland
Website
videah.xyz
XP
146
Country
New release time, with some pretty cool changes (At least, I think they're cool)

Audio Support!
No longer do LövePotion games have to be mute, as I got love.audio implemented!
So far the only formats supported are .raw (with a sample rate of 44100) and .wav files.
In the future I hope to add .ogg support and a bunch of other audio features.

  • love.audio.newSource
  • love.audio.stop
  • source:Play
  • source:stop
  • source:setLooping
  • source:isLooping
  • source:isPlaying
Quads
With the request and help from TurtleP, I've added Quads!
Since I'm not good at explaining what they are, here is what the LÖVE wiki says
Quads can be used to select part of a texture to draw. In this way, one large texture atlas can be loaded, and then split up into sub-images.

  • love.graphics.newQuad

Fixes
  • Fixed start not doing anything on the error screen
  • Properly handle current working directory (Lua's built in io library should work properly now)
  • love.graphics.draw's x and y argument is now correctly set to optional
  • Fixed love.errhand not showing correctly when the error has special characters in it
  • Fixed 3D offsetting bottom screen draw calls by accident

Known Issues
  • Running love.event.quit whilst a looped sound playing can cause really weird sound distortion problems.
 

TurtleP

Well-Known Member
Member
Joined
Oct 7, 2015
Messages
140
Trophies
0
Age
28
Website
TurtleP.github.io
XP
308
Country
United States
A simple solution for looping sounds for now:

Find a condition in the update function in which you want to play the source. Check if it's not playing, and if it isn't, play it. Perfect looping with no mess.

For example:

function love.update(dt)
if not mySource:isPlaying() then
mySource:Play()
end
end

This only works for a single piece of looping music, so you'd have to specify other things if you want multiple sources to work like this.
 

TurtleP

Well-Known Member
Member
Joined
Oct 7, 2015
Messages
140
Trophies
0
Age
28
Website
TurtleP.github.io
XP
308
Country
United States
You cannot resize text unless you make a new Font object:

myFont = love.graphics.newFont("path/to/font.ttf", size)

Currently there is a limit of 2 fonts which is unfortunate. This will be fixed in the future.
 
  • Like
Reactions: NodePoint

Swooky

Member
Newcomer
Joined
Aug 24, 2015
Messages
18
Trophies
0
Age
25
XP
113
Country
Netherlands
When I try to load the latest release files from github. It give me an error stating that it can't load main.lua. What could I be doing wrong?

EDIT: Nevermind. For some reason Citra wants the files of the game folder to be in /user/sdmc/ . When I put them there it just works. That is pretty weird.
 
Last edited by Swooky,
  • Like
Reactions: 8BitWonder

Jack_Sparrow

Ruthless Pirate
Banned
Joined
Nov 17, 2015
Messages
852
Trophies
0
Age
37
Location
The Black Pearl
Website
www.nintendo.com
XP
495
Country
United States
xUwb9qF.png

LövePotion is an unofficial work in progress implementation of the LÖVE API for 3DS Homebrew.

G9QjjjN.png


If you're not aware of LÖVE, it's a framework you can use to make 2D games in Lua.

To learn C, I decided to make an unofficial port of its API to 3DS, which I feel is in a state I can make a beta release. It is still nowhere near completion and there's still a lot to be done, but very simple games can be made very easily.

You can look at/contribute to the source code on the projects GitHub.
You can download builds from the GitHub Releases page.

Make sure to check out the LÖVE Wiki, aswell as the Implemented list to see what you can use.
You should update your Github. It says R.I.P Browserhax. (Which is back)
 

haazet

Well-Known Member
Newcomer
Joined
Dec 15, 2015
Messages
64
Trophies
0
XP
159
Country
United States
Hey this will be my first game, but ive made Tetris in Unity with a couple tutorials copied and pasted together. Can anyone clarify what this code isn't moving my player by 15 along the X when Right or Left is Held? I was looking at the previous posts did it and mine seems the same. Thanks for Port of Love and the Sample that comes along with it. Ive got my level and characters running on my n3ds http://imgur.com/a/Pb98F.

Here is a Paraphrasing,
Code:
-- Loads images from filepaths
    logo.image = love.graphics.newImage('rightskim.png')

    logo.x = 200
    logo.y = 120
   
    --Me adding Speed
    logo.speed = 15

-- Draw Player
    love.graphics.rectangle('line', logo.x - 3, logo.y - 3, 55 + 6, 50 + 6)
    love.graphics.draw(logo.image, logo.x, logo.y)

function love.update(dt)
if love.keyboard.isDown("left") then
     logo.x = logo.x - logo.speed
   elseif love.keyboard.isDown("right") then
     logo.x = logo.x + logo.speed
   end


    end
 

Attachments

  • main.txt
    3.4 KB · Views: 242

VideahGams

Well-Known Member
OP
Newcomer
Joined
Aug 29, 2015
Messages
91
Trophies
0
Age
25
Location
Glasgow, Scotland
Website
videah.xyz
XP
146
Country
Hey this will be my first game, but ive made Tetris in Unity with a couple tutorials copied and pasted together. Can anyone clarify what this code isn't moving my player by 15 along the X when Right or Left is Held? I was looking at the previous posts did it and mine seems the same. Thanks for Port of Love and the Sample that comes along with it. Ive got my level and characters running on my n3ds http://imgur.com/a/Pb98F.

Here is a Paraphrasing,
Code:
-- Loads images from filepaths
    logo.image = love.graphics.newImage('rightskim.png')

    logo.x = 200
    logo.y = 120
 
    --Me adding Speed
    logo.speed = 15

-- Draw Player
    love.graphics.rectangle('line', logo.x - 3, logo.y - 3, 55 + 6, 50 + 6)
    love.graphics.draw(logo.image, logo.x, logo.y)

function love.update(dt)
if love.keyboard.isDown("left") then
     logo.x = logo.x - logo.speed
   elseif love.keyboard.isDown("right") then
     logo.x = logo.x + logo.speed
   end


    end

Is the player moving at all when you do press DPad left or right?
Because the code is working on my end
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • ZeroT21 @ ZeroT21:
    it wasn't a question, it was fact
  • BigOnYa @ BigOnYa:
    He said he had 3 different doctors apt this week, so he prob there. Something about gerbal extraction, I don't know.
    +1
  • ZeroT21 @ ZeroT21:
    bored, guess i'll spread more democracy
  • LeoTCK @ LeoTCK:
    @K3Nv2 one more time you say such bs to @BakerMan and I'll smack you across the whole planet
  • K3Nv2 @ K3Nv2:
    Make sure you smack my booty daddy
    +1
  • LeoTCK @ LeoTCK:
    telling him that my partner is luke...does he look like someone with such big ne
    eds?
  • LeoTCK @ LeoTCK:
    do you really think I could stand living with someone like luke?
  • LeoTCK @ LeoTCK:
    I suppose luke has "special needs" but he's not my partner, did you just say that to piss me off again?
  • LeoTCK @ LeoTCK:
    besides I had bigger worries today
  • LeoTCK @ LeoTCK:
    but what do you know about that, you won't believe me anyways
  • K3Nv2 @ K3Nv2:
    @BigOnYa can answer that
  • BigOnYa @ BigOnYa:
    BigOnYa already left the chat
  • K3Nv2 @ K3Nv2:
    Biginya
  • BigOnYa @ BigOnYa:
    Auto correct got me, I'm on my tablet, i need to turn that shit off
  • K3Nv2 @ K3Nv2:
    With other tabs open you perv
  • BigOnYa @ BigOnYa:
    I'm actually in my shed, bout to cut 2-3 acres of grass, my back yard.
  • K3Nv2 @ K3Nv2:
    I use to have a guy for that thanks richard
  • BigOnYa @ BigOnYa:
    I use my tablet to stream to a bluetooth speaker when in shed. iHeartRadio, FlyNation
  • K3Nv2 @ K3Nv2:
    While the victims are being buried
  • K3Nv2 @ K3Nv2:
    Grave shovel
  • BigOnYa @ BigOnYa:
    Nuh those goto the edge of the property (maybe just on the other side of)
  • K3Nv2 @ K3Nv2:
    On the neighbors side
    +1
  • BigOnYa @ BigOnYa:
    Yup, by the weird smelly green bushy looking plants.
    K3Nv2 @ K3Nv2: https://www.the-sun.com/news/10907833/self-checkout-complaints-new-target-dollar-general-policies...