Page 1 of 2

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

Posted: Wed Apr 22, 2015 9:12 am
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 ^_^'

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

Posted: Wed Apr 22, 2015 10:49 am
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.

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

Posted: Wed Apr 22, 2015 12:10 pm
by Calandriel
Ok... didn't work. heres the .love:

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

Posted: Wed Apr 22, 2015 1:04 pm
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.

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

Posted: Wed Apr 22, 2015 4:26 pm
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...

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

Posted: Wed Apr 22, 2015 8:42 pm
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).

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

Posted: Thu Apr 23, 2015 5:24 am
by dizzykiwi3
While you're at it you should be increasing the font size instead of scaling it up
love.graphics.setNewFont(fontsize)

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

Posted: Thu Apr 23, 2015 11:30 pm
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:

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

Posted: Sat May 02, 2015 8:52 am
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

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

Posted: Sat May 02, 2015 9:17 am
by Calandriel
And here's the .love of the 1st level