I'm another noob and lover... And I need some help :)

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Calandriel
Prole
Posts: 39
Joined: Wed Apr 22, 2015 9:00 am

I'm another noob and lover... And I need some help :)

Post by Calandriel »

I am working in a game(When I have time, which university took too much, but I'm studing computer scicence, so, it helps me a lot) and I get stuck in the score. Every time I make

Code: Select all

love.update(dt)
if hit==true then
score=score+1
end
end
when I print the score, it keeps increasing "foreverly". It makes me sad. Could you help me guys?
oh, one more thing. English is not my nature language, so if i'd wrote something wrong, im sorry ^_^'
If violence is not solving all your problems, You're simply not using enough of it.
Twitter: https://twitter.com/Calandriell Some news about wtf I'm doing.
Tumblr:https://www.tumblr.com/blog/calandriell I use to draw some random stuff.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: I'm another noob and lover... And I need some help :)

Post by Robin »

You don't seem to change back the variable hit.

See if this works:

Code: Select all

function love.update(dt)
    if hit then -- you don't need "== true" if it's already going to be a boolean!
        score = score + 1
        hit = false
    end
end
If it doesn't, please upload a .love so we can see everything.
Help us help you: attach a .love.
User avatar
Calandriel
Prole
Posts: 39
Joined: Wed Apr 22, 2015 9:00 am

Re: I'm another noob and lover... And I need some help :)

Post by Calandriel »

Ok... didn't work. heres the .love:
Attachments
Pervt.love
made on 0.9.2
(36.46 KiB) Downloaded 73 times
If violence is not solving all your problems, You're simply not using enough of it.
Twitter: https://twitter.com/Calandriell Some news about wtf I'm doing.
Tumblr:https://www.tumblr.com/blog/calandriell I use to draw some random stuff.
User avatar
Calandriel
Prole
Posts: 39
Joined: Wed Apr 22, 2015 9:00 am

Re: I'm another noob and lover... And I need some help :)

Post by Calandriel »

Aaand... that's just the skeleton. The final project has a name, pngs, and a story totaly diferents. I'm just using that picturs, cause they were easy to draw, and i dont have an art editor, so I'm drawing things. And don't ask me how's gonna be the sounds, :p. So, I'd drawn everything. and... well... if it's just the base, a naked guy it's a good avatar. A nun it's a good people to scare and... naked guys and nuns probaly ends in calling cops... So don't be angry bout the pictures ^^'... the final game will be abou a rockstar who have to go to show, and wherever he goes fans get like "OOH", and paparazi(papparazi? paparazzo? I don't know write this ;-;) try to beat him down.
If violence is not solving all your problems, You're simply not using enough of it.
Twitter: https://twitter.com/Calandriell Some news about wtf I'm doing.
Tumblr:https://www.tumblr.com/blog/calandriell I use to draw some random stuff.
User avatar
I~=Spam
Party member
Posts: 206
Joined: Fri Dec 14, 2012 11:59 pm

Re: I'm another noob and lover... And I need some help :)

Post by I~=Spam »

I was really enthusiastic about helping due to the content of the love but you explaination is the only reason I tried somewhat... I don't really want to debug it much but based on what is happening I am guessing that the if statement is called and does set "hit" to false but the very next "love.update" hit is set to true again because the objects are close together....

Again it might be a good idea to clean things up first before you post any content that isn't rated "G" or "PG" :roll: While I am not a child there really are children who use this forum...
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: I'm another noob and lover... And I need some help :)

Post by davisdude »

The problem is that while you do SET hit to false, it gets set right back to true again because you qualify as within the "hurt" coordinates, so hit gets set to true again.
What you should do is:
- Either move the player back on hit (thus resolving the collision)
- Or make a timer so that you can only get hurt every X seconds (i.e. invincibility).
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
User avatar
dizzykiwi3
Citizen
Posts: 58
Joined: Tue Jan 14, 2014 2:03 am

Re: I'm another noob and lover... And I need some help :)

Post by dizzykiwi3 »

While you're at it you should be increasing the font size instead of scaling it up
love.graphics.setNewFont(fontsize)
User avatar
Calandriel
Prole
Posts: 39
Joined: Wed Apr 22, 2015 9:00 am

Re: I'm another noob and lover... And I need some help :)

Post by Calandriel »

It's working!! You're awesome, guys, thanks!!
So now I'll jus work on add better box colliders and more characters, and change the pictures, :ultrahappy:
If violence is not solving all your problems, You're simply not using enough of it.
Twitter: https://twitter.com/Calandriell Some news about wtf I'm doing.
Tumblr:https://www.tumblr.com/blog/calandriell I use to draw some random stuff.
User avatar
Calandriel
Prole
Posts: 39
Joined: Wed Apr 22, 2015 9:00 am

Re: I'm another noob and lover... And I need some help :)

Post by Calandriel »

Hey, I'm back. Again. I know, I'm annoying, sorry. But, I guess i'd completed the first stage of my game. I want to make more 5, adding more backgrounds, weapons, npcs and etc. but I'm stuck. How do I make the game restart when I'm dead? And how do I load the first stage if I win? I saw a topic bout this, but I dont get it very well
If violence is not solving all your problems, You're simply not using enough of it.
Twitter: https://twitter.com/Calandriell Some news about wtf I'm doing.
Tumblr:https://www.tumblr.com/blog/calandriell I use to draw some random stuff.
User avatar
Calandriel
Prole
Posts: 39
Joined: Wed Apr 22, 2015 9:00 am

Re: I'm another noob and lover... And I need some help :)

Post by Calandriel »

And here's the .love of the 1st level
Attachments
Perv.love
(59.36 KiB) Downloaded 79 times
If violence is not solving all your problems, You're simply not using enough of it.
Twitter: https://twitter.com/Calandriell Some news about wtf I'm doing.
Tumblr:https://www.tumblr.com/blog/calandriell I use to draw some random stuff.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests