Help for a tug of war game.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Posts: 1
Joined: Sun Jun 24, 2018 4:48 pm

Help for a tug of war game.

Post by angrydonald » Sun Jun 24, 2018 4:51 pm

So im just trying to make a simple game. Which is a Tug of War game. Everything works but, when x==-10 or x== 10 it should say which side wins but it doesnt.

if x == -10 then
text = "red wins! Please wait"
x = 0
text = ("Keep Smashing")
here is the code. If anyone can tell me what i did wrong, and correct me that be nice. Also it change by increments of 1.

User avatar
Party member
Posts: 286
Joined: Mon Aug 22, 2016 2:25 pm

Re: Help for a tug of war game.

Post by Sir_Silver » Sun Jun 24, 2018 7:41 pm

I think you still need to upload your code.

User avatar
Inner party member
Posts: 814
Joined: Sat Dec 10, 2011 7:18 pm

Re: Help for a tug of war game.

Post by veethree » Sun Jun 24, 2018 7:45 pm

Code: Select all

if x == -10 then
This will only be true if x is exactly -10. Depending on how you're manipulating it, X might never be exactly -10. What you should do is something like this

Code: Select all

if x <= -10 then
This checks if x is lower or equal to -10.

User avatar
Party member
Posts: 2801
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary

Re: Help for a tug of war game.

Post by zorg » Sun Jun 24, 2018 8:56 pm

also don't use love.timer.sleep like that; you're expecting graphics to magically pop up because of that, but in reality, that's not how the game loop works. keep a timer around, and change the text value and stuff after a set amount of time elapsed; use love.update and dt for that.
Me and my stuff :3True 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.

Post Reply

Who is online

Users browsing this forum: bludburn and 39 guests