Hello, today I'm going to show you how to make a game from scratch for DSi/DSi XL/3DS/3DS XL/2DS.
You may ask, "How do you do that? Do you need Homebrew?". Well, you don't. And, it's quite simple.
All you need is:
- A DSi/DSi XL/3DS/3DS XL/2DS
- A copy of Petit Computer downloaded on your system*
- A little time**
*Petit Computer has been removed from the 3DS eshop. It is however on the DSi Shop.
**The required amount of time depends on how complex the game is and how much debugging it needs to be complete.
Step 1: A Simple Code to Get You Started
Now, after you have downloaded your game, go ahead and open it. Once you've opened it, tap "Write Program". At the bottom of the screen, there should be a button saying "EDIT". Tap that button. Now type the following.
PRINT "Press A to make noise"
IF BTRIG()==16 THEN BEEP 3
You're probably wondering what all that is. So I'll explain. The @START is just a place where it loops back to so it doesn't just execute a little bit of code and then stop. CLS means Clear Screen. When it says PRINT "Press A to make noise" that means it will say exactly what it says in the quotation marks. IF BTRIG()==16 THEN BEEP 3 means that when you press A(16 = The A button) then it will make a little beeping noise(BEEP 3).
The WAIT 1 keeps it from "glitching out". GOTO@START means pretty much what it sounds like. It loops it back to The top of the code so it doesn't stop.
Step 2: Let's Get to the Game!
Alright, the moment you've been waiting for! The code for the game! Here's the code:
PRINT " My First Game in PTC"
PRINT "Press START to begin"
IF BTRIG()==1024 THEN GOTO@GAME
PRINT "0" 'Side note: You can change the text inside the quotes to something different.
IF BUTTON()==1 THEN Y=Y-1
IF BUTTON()==2 THEN Y=Y+1
IF BUTTON()==4 THEN X=X-1
IF BUTTON()==8 THEN X=X+1
There are the basics for ya'! I know it's sort of lame, but I had to keep it simple. So where it says X=15 and Y=11, those mean that the letter(X and Y) are the same as the numbers assigned. These are called Integers. Under @GAME, where it says LOCATE X,Y means that it prints the text in a specific area on the screen. The X is side to side. The Y is up and down. All the IF BUTTON()==__ THEN _=_ (+ or -) 1 means that when you press the buttons, X or Y becomes greater or smaller. This is what moves the text. It moves it by changing the location "one at a time".
If you want to experiment with what the numbers the buttons are assigned to then use this simple code:
Notice that BUTTON() doesn't have any quotation marks around it.
Step 3: Debedebedebedebe, That's All Folks!
You heard him, That's all Folks! Be looking for another 'ible made by me! Yep, you guessed it, part two. The next one I'm going to be making is going to be more in depth than this one, and show you how to use sprites and more!
Please comment if you have troubles of any sort, or, if you just liked it!