Hi everyone. I'm new and pretty much stupid Lover, so, i got a little problem, which i can't solve by myself. Also, i'm russian and that mean i now nothing about how to chat on english, so please, be kind to me:)
The problem is - i'm trying to create a "construction mode" state for my game, where you can place a building (gnome shelter) wherever you want, looking on how it will look when it's done with the help of kind of pre-building look. Well, how it usually can be found on any strategy games. So, i got a pre-building look - there is a shelter levitating along X-asis with the mouse moving around, but when i'm clicking left mouse button, which is supposed to mean that i choose a place to construct and building must be placed, building is, regarding to the ways i code, neither disappearing or continuing to follow the mouse, like it was no mouse click. I'd like to know about the ways you would create such a system, because no matter how hard i try, it's not working.
Subject: http://zalil.ru/32376028
Creating buildings once and forever, how?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Creating buildings once and forever, how?
You could do it basically two ways:
- Keep a list of buildings. When you click, a copy of the building is appended to the list.
- Keep a grid of buildings. When you click, insert a copy of the building in its current position.
Help us help you: attach a .love.
Re: Creating buildings once and forever, how?
Can you, please, show an example?) I think i don't get it.
How can i make building not to disappear, when "constructionMode = false"? I see it's disappearing because of "constructionMode == true" condition, which is not true, when construction mode is off and building supposed to be constructed.
How can i make building not to disappear, when "constructionMode = false"? I see it's disappearing because of "constructionMode == true" condition, which is not true, when construction mode is off and building supposed to be constructed.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Creating buildings once and forever, how?
Ah, I see the problem. You only draw one building.
Instead of:
do:
Instead of:
Code: Select all
if build == true then
love.graphics.draw(constructions[constructionsNum], mouseX, 357)
end
Code: Select all
for i, building in ipairs(constructions)
love.graphics.draw(building, mouseX, 357)
end
Help us help you: attach a .love.
Re: Creating buildings once and forever, how?
I did it!
http://zalil.ru/32379426 - fresh Main.lua with the decision
There is still some spare unuseful picture coming up in construction mode, but that's not critical and will be solved eventually:)
Anyway, thanks a lot, Robin)
http://zalil.ru/32379426 - fresh Main.lua with the decision
There is still some spare unuseful picture coming up in construction mode, but that's not critical and will be solved eventually:)
Anyway, thanks a lot, Robin)
Who is online
Users browsing this forum: No registered users and 5 guests