Gun Image, and while true dos?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Gun Image, and while true dos?
Alright well ive been trying to add a while true do to my game with sleep time added to it, but it just keeps freezing up. Is there a way to weld a image together or something? If theres not I'm gonna just have to make another character with a gun in ps... Plz help ive been looking for a day and a half for something this small.
Re: Gun Image, and while true dos?
Post your code. Makes it significantly easier for us to help you.
If you have a while true loop with love.timer.sleep() in it, I'd assume your game will be frozen until that loop stops.
As for welding an image together, You can just draw the first image at a certain position, then calculate where the 2nd one goes based on the first ones position.
If you have a while true loop with love.timer.sleep() in it, I'd assume your game will be frozen until that loop stops.
As for welding an image together, You can just draw the first image at a certain position, then calculate where the 2nd one goes based on the first ones position.
Code: Select all
local x, y = 100, 100
love.graphics.draw(image, x, y)
love.graphics.draw(image, x + 10, y)
Re: Gun Image, and while true dos?
Posting code is the best way to get help instead of anyone having to guess what the problem is.
Re: Gun Image, and while true dos?
Well yeah that's by design, that's what sleep function does - freezes the game for the duration you need, give or take, while freeing up CPU power to other programs.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Gun Image, and while true dos?
Also, löve already has a while true do loop, in love.run, which is the game loop itself...
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.
Re: Gun Image, and while true dos?
If you want a timer just use two variables. TimePassed and TimeToPass. You increase TimePassed in love.update, and when it reaches TimeToPass you do what you want to do. Ex: I want the player to say "hello world" every 5 secs. Obviously you reset TimePassed to 0 once you entered the condition
Re: Gun Image, and while true dos?
Obviously not because then the player would say hello world in a rate of 5+x. Also you could decrease TimeToPass and than add the initial amount when TimeToPass is negativ or zero. So you could omit TimePassed.
Who is online
Users browsing this forum: Ahrefs [Bot] and 2 guests