Reputation: 1186
I am trying to make flappy birds copy with Kivy, but at the moment I am having hard times. The problem is I don't know how to create multiple widgets in view.
Now I have in my kv file:
<Game>:
col: column
Column:
id: column
<Column>:
pos: 0, 0
canva:
Rectangle:
pos: self.top_column_position
size: 30, self.height
Rectangle:
pos: self.bottom_column_position
size: 30, self.height
At the moment I am able to make single column, so the question is how to make so I could have multiple columns?
Upvotes: 0
Views: 761
Reputation: 29460
You kv language syntax has some problems:
<Game>:
should be indented by 4 extra spaces.canva
where you mean canvas
.I don't know what you mean about columns, you haven't given any information about what layouts you're using. In general, a solution might be to make your Game
widget subclass BoxLayout
, then simply add multiple column widgets beneath it and let this BoxLayout
take care of rearranging and positioning them.
I previously implemented the basic mechanics of the game, available here. I took quite a different approach to what you seem to be doing, and the implementation is very basic, but perhaps it can help you.
Upvotes: 5