Defold need collection of small examples


I was checking out Raylib and found that it has an amazing collection of feature examples.
Then I remembered that pixi.js and phaser have nice examples too.
I mean super bare bone, down to the point feature examples with projects.
I’m really interested to see simple 2x objects collision examples (also with raycasting too). I’d be down to land a hand on really simple ones (moving object with code, sprites, etc).



You mean like these:

1 Like


Now I feel stupid…
But yeah, like those but more - I don’t see raycast collision, camera features, materials, game window size and scaling.
If I want to make addition, how would I submit?



Sorry I didn’t want to hurt you.

Yes, you can add new examples or/and fix old here:



:smile: I made myself feel like that.
Got to say I don’t understand anything about how I should add new examples there. I barelly know how to update my repository using GitHub desktop.

1 Like


There are also great examples from @britzl

If it comes to github and if you want to add an example here, you need to:

  1. Download a repo - Creating a Fork
  2. Create your example in the downloaded directory
  3. Use Github desktop or any client or just Git bash to create a commit wih your changes and pull it to your newly created fork
  4. Request a Pull Request to merge your changes into examples repo.

Repository is like a cloud folder, but in this case you need to ask if you can add something there - that’s why fork and pull request are needed. There are a lot of instructions in the internet and even if you click to fork on Github, you will be provided with detailed instructions. In any case, don’t hesitate to ask :wink:



I know about @britzl examples and johnyking examples, benjames games.

But most of those are not bare bone examples.
Check how Raylib has them.

1 Like


Actually imho there aren’t so bare bone :smiley: what do you think we are lacking among Defold examples? It could be helpful to point out those, so anyone on the forum can maybe prepare some :wink:



I had problems to get raycast collision working, so I’d like to see how that is working.
There are no examples of the camera - how to handle camera view, camera follow (for this I have my workaround by moving world in the opposite direction :smiley: ).
There are no examples for materials.
In the example, section needs a lot more examples of simple stuff newcomer would to look up and could piece together a whole game like lego just by looking up examples of tiny features (ok, got a camera, now how to make the camera follow a player).



Do you have more examples of examples that you’d like to see?

1 Like


It’s not really what I want, but those are the first things that I’m going to tackle after I’m happy with TrueTileCollision.
Maybe some useful bits like spawning objects, collection proxy load/unload. Even tho those are in tutorials I think they should be standalone examples too and seen without going through tutorials.
Sprite animation examples from manual feels like it should be in examples. It kinda feels like all the goods are all over the place.
Manual itself kinda acts as example section but in broad strokes.

1 Like


We don’t have this. I’ll add it to my list.

It is:



I’m really happy to see new additions. I’ll try to make some too.
@britzl, how are you editing *.md files (formating text and pictures)?



I haven’t added any yet. The ones I’ve linked to were already there!

I’ll see if I have time to add one or two examples next week though.

I use Atom with a markdown preview plugin.

1 Like


You can also use Brackets with the following extension:

Find your favorite tool by trying many of them.

There are many resources to dig for but they are scattered all around the place. I think useful examples should be grouped in the same location. Maybe users should consider submitting them to the examples section of the site repository instead of letting them in their own personal repositories.

@britzl I’m currently looking at your public examples but this is still hard to find a logical order to study them. Also, many people don’t need explanations or comments to decrypt an example project but other people (like me) need some more infos to better grasp the whole picture. I know your time is limited so I don’t ask to add explanations but I just wanted you to keep that in mind for future reference.

I think some community collaborative work should be best to create and improve examples in an iterative process.



I wouldn’t treat them as tutorial for Defold, with ordered knowledge, but only as a clue, when some specific idea/thing is needed to implement.

1 Like


Actually, you’re right.
What’s really missing is more tutorials.
Knowing what does the building blocks is a good starting point but sometimes one needs to have hints on how to put together those pieces into something more complex. Dividing each step into manageable chunks is a good way to understand the overall project. But ultimately we also need to put back those elements into the whole concept. this is some kind of ping pong process between playing with building block and having a clear view of the final target. Without a clear plan in mind, building blocks are useless.



Exactly. They never were intended as tutorials or anything like that. When I got asked a question on the forum I created and example to answer the question, put it into that repository and added a readme with a very brief description and usually also a link to the forum.

After some time I created the webpage with the thumbnails to better showcase them. And I added links to some games that I had done for game jams.



I started working on this today and have so far only had time to add raycasts:

More will come next week.



Added a camera example: