Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Klass.empty? #66

Open
ghost opened this issue Mar 3, 2014 · 2 comments
Open

Klass.empty? #66

ghost opened this issue Mar 3, 2014 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 3, 2014

Hi, I have a question about game objects. How can I know if exist objects of a particular class? That is, I need to do something like:
if Enemy.empty?
# logic if not objects of Enemy class.
end
Could create an Array with all the enemies but do not want to create variables if not necessary. I tried with "Array(Enemy).empty?" but nothing.

Another question is that when I load a font, the console throws me this:
ERROR: failed to open './resources/8_bit_madness.ttf'
ERROR: CreateFile failed

The code is this:
@ text_starge = Text.create (: text => "# {@ starge STARGE}",: size => 25,: font => "resources/8_bit_madness.ttf")

Any help?. Thanks!

@ghost ghost closed this as completed Sep 5, 2014
@ghost ghost reopened this Sep 5, 2014
@ippa
Copy link
Owner

ippa commented Sep 6, 2014

Did you try Enemy.all ?

About the font-error: Under the hood Chingu uses Gosu::Font.new to draw text .. so a font-error most likely comes from there. You might want to check your paths .. but if the path is 100% correct, you need to check into why Gosu doesn't want to open that font. Try open it with pure Gosu for example.

@ghost
Copy link
Author

ghost commented Sep 22, 2014

I had a small mess in the organization of the directories and therefore Chingu did not recognize me the assets correctly. Indeed, Enemy.all fix everything, is easy to manipulate the objects using arrays. Thank!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant