Coding Help
-
- Prole
- Posts: 6
- Joined: Sat Feb 16, 2019 5:57 pm
Coding Help
Hey! Im New At "LOVE2D" And Iam Making A Game And I Have A Problem... The Problem Is I Want When The Player Touchs The Spike It Prints Game Over Please Help.
Re: Coding Help
You'll have better luck getting help if you include a .love file or show some relevant source code. Are you new to programming in general, or just LÖVE? You're probably looking for how to detect collisions between two rectangles, aka "Axis-Aligned Bounding Boxes" (AABB). Here's an article on that subject with source code that's easily converted to Lua.
LÖVE-Nuklear - a lightweight immediate mode GUI for LÖVE games
-
- Prole
- Posts: 6
- Joined: Sat Feb 16, 2019 5:57 pm
Re: Coding Help
Here is The Game Open The File And Continue And It Will Be Extractedhttps://www.mediafire.com/file/4jc051tk ... e.exe/file (Its For Windows Only)
Last edited by Steven Rafft on Sun Feb 17, 2019 6:27 pm, edited 2 times in total.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Coding Help
Instructions unclear, mediafire gave me a trojan and now my computer won't boot
But seriously, upload a love file without combining it with love.exe, onto the forums here; there's an upload attachment button.
Edit: Don't worry about it It's just the safer way, and i actually did almost get one in the past from there... it depends on the ads they show you.
But seriously, upload a love file without combining it with love.exe, onto the forums here; there's an upload attachment button.
Edit: Don't worry about it It's just the safer way, and i actually did almost get one in the past from there... it depends on the ads they show you.
Last edited by zorg on Sun Feb 17, 2019 5:52 pm, edited 1 time in total.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
-
- Prole
- Posts: 6
- Joined: Sat Feb 16, 2019 5:57 pm
Re: Coding Help
weird i'v never got a virus from mediafire but okay
i also didn't notice there is an attachment button sorry i'm new to the forums .
i also didn't notice there is an attachment button sorry i'm new to the forums .
-
- Prole
- Posts: 6
- Joined: Sat Feb 16, 2019 5:57 pm
-
- Prole
- Posts: 6
- Joined: Sat Feb 16, 2019 5:57 pm
Re: Coding Help
ah not a problem i understand that popups can come randomly and make this happen but i think adblocker blocks them anyways
Re: Coding Help
1. Not critical, but you might want to look into using the "local" keyword when declaring your variables (global variables are, in general, bad practice).
2. This does absolutely nothing:
3. Get rid of the ox/oy arguments to draw (they just make the math more complicated):
4. Initialize playery to be the correct value in love.load:
5. Check for collisions like this at the end of your love.update function:
Note that the above code is basically directly translated from that link I shared earlier.
2. This does absolutely nothing:
Code: Select all
love.timer.step(playerx - playery)
Code: Select all
love.graphics.draw(playerimg, playerx, playery)
Code: Select all
playery = platformy - 16
Code: Select all
if playerx < 300 + 19 and
playerx + 29 > 300 and
playery < 220 + 13 and
playery + 16 > 220 then
print "Collision!"
end
LÖVE-Nuklear - a lightweight immediate mode GUI for LÖVE games
-
- Prole
- Posts: 6
- Joined: Sat Feb 16, 2019 5:57 pm
Re: Coding Help
nevermind
Code: Select all
if playerx < 300 + 19 and
playerx + 29 > 300 and
playery < 220 + 13 and
playery + 16 > 220 then
print "Collision!"
end
Who is online
Users browsing this forum: Google [Bot] and 7 guests