How would I actually show stuff in my game?

I literally got Defold today, so bear with my stupidity please :grinning:

So, I’ve imported my images. I made an atlas file (because I have separate images for each animation frame) and made a few animation groups (idle, walk-right and walk-left). Then I made a Game Object (.go file) and there I made a sprite with my idle animation (I’ll add the other 2 when I need them). So, now that I have a game object, how do I get the game to show my character?

1 Like

To show a game object, you then need to put it in a collection. For simplicity, place the game object in the main.collection just to get a feel for things.

As you work on your game more and more, you will likely wanna put them somewhere other than the main.collection, like a world.collection.

1 Like

Hey so I added my character to main.collection but when I run my game it still doesn’t show up (saved the file). I suppose I have to add a camera or something? @gamzwithjamz

You should not need a camera because the main.collection will be bootstrapped and therefore will load immediately. When you look at the main.collection, a white rectangle will show up which is telling you what will be immediately visible (the viewport). Make sure the character is within that rectangle.

Well, my character has a white rectangle around it in main.collection (it moves when I move the character). I zoomed out to the point where my character was a small pixel but no other rectangle was there. My character is at position 0,0 anyway @gamzwithjamz

You are correct, that is my bad. The white rectangle is due to a gui object I have in my game. If your character is at (0, 0), it is possible they are simply offscreen. Can you send a screenshot of your main.collection?


Here’s a screenshot of my entire editor on main.collection, I have selected the game object. @gamzwithjamz

Does your game.project have this selected?image

1 Like

image @gamzwithjamz Yep.

Interesting. Do you mind making your code available for me to look at and run myself?

I don’t have any code written yet. @gamzwithjamz

Or, if you meant my game.project:

[bootstrap]
main_collection = /main/main.collectionc

[script]
shared_state = 1

[display]
width = 960
height = 640

[project]
title = AGWON

[graphics]
default_texture_min_filter = nearest
default_texture_mag_filter = nearest

Sorry, I meant would you mind sharing the whole Defold project so I can build it locally?

Sure, give me a moment.

[file personally censored]
Found it @gamzwithjamz

Good news! You were doing it correctly.

I did not change anything and your character is just a tiny blip partially offscreen at the bottom left. The origin of the world (0, 0) is at the bottom left of the screen, so you just need to consider that.

1 Like

Oh my god now I see it! Thank you very much @gamzwithjamz!

2 Likes

No problem @pitaya4! Enjoy!

1 Like

Would be useful if you are making a pixel art game.

2 Likes

@gamzwithjamz can you help me i cant see a model in my game