Forums

Topic: Petit Computer

Posts 3,021 to 3,040 of 9,620

Nitras

I hate to sound impatient, but I need to know if anyone has looked into my coding so I know whether or not I should wait for feedback.

Nitras

Pixelrobin

hey ummm so yeah....
I GOT MAH 3DS BACK!!!!!!
Nintwndo did a really neat job with it. Sadly I had to pay, but now my system is working better than brand-new. They added things such as guards that protect dust from getting into the buttons and I even got a new coating! If you are somehow reading this, thank you Nintendo! You put my $81 to good use! So its back to petit computer! I was thinking I could upgrade Temple Raid and add sprites for smoother movement, smarter ai (Mwahaha), more enemies sych as a mole that digs through walls, and a level editor. I will also polish our pixel art ptogram (Many thanks to @Discostew) then keep working on Battlewoods. Back to busy-ness.

Everybody do a chirp. CHIRP.

3DS Friend Code: 3007-9228-5126

GeekDude

@Bluerobin2 That's great! Too bad I voided my warranty with a third battery pack. I'm hoping I won't need a warranty.

Anyways, I've put together a snake game, which is playable, but needs a bit of work. I'm posting the current code here so people can enjoy while I work on it.
Untitled

Any way to print to the console without having it scroll on the bottom line?

GeekDude

Pixelrobin

@GeekDude
LOCATE X-POSITION,Y-POSITION:PRINT 'STUFF
Them ':' is not needed but recommended.
X can be anywhere between 0 and 32.
Y can be anywhere between 0 and 23.
If you get to 32 or 23 then it will auto-scroll sadly but you can do something like:
(1,1),(22,1),(1,31),(22,31)
That will make a rectangle 8 pixels away from each side of the screen resulting in a pleasing view. Then you could center the score and other info on the top line since its open. Kinda like what I did with Temple Raid...
Hope it helps!

Everybody do a chirp. CHIRP.

3DS Friend Code: 3007-9228-5126

randomous

@GeekDude If you move everything to the touchscreen, it won't have that problem. Not that it's always a viable option, but it's still a nice place to put console stuff if you don't want the scroll effect. On a slightly separate but still relevant note, I made a "driving" game based on the scrolling effect quite a while back: https://www.nintendolife.com/forums/dsiware/petite_computer_qr...

Edit: On another note, @Patriplexity asked for an 8 bit version of the "Gravity Falls" Theme, which you can find here. Then @TexMurphy asked for an MML tutorial, so I wrote a basic starting guide to MML on the tutorial thread. I know it's long, but hopefully it helps someone.

Edited on by randomous

randomous

Pixelrobin

I might have been a bit confusing...
If you do not include the ':', put the PRINT on the next line.
Hopefully SmileBoom will release a new version that includes an AUTOSCROLL system variable (Kinda like SYSBEEP). About Temple Raid, Do you guys want the snake to be able to navigate around corners? Or is it hard enough as-is.

Everybody do a chirp. CHIRP.

3DS Friend Code: 3007-9228-5126

Discostew

@GeekDude

Leaving a PRINT statement with only text will force an automatic carriage return. Placing a semi-colon at the end of the statement will prevent the carriage return mechanism, like so...

'Prints "HelloWorld" on the same line, but moves the print position to next line after 'World'
LOCATE 0,0
PRINT "Hello";
PRINT "World"

So, in your @BRDRDRAW subroutine at the end of your IF statements, just place a semi-colon after each PRINT statement. Using a semi-colon also works like concatenation (or adding to the text like using '+'), so you could do this if you wanted to.

PRINT "Hello";"World "

Of course that would be silly for text like this, but it is useful for printing variables.

PRINT VAR1;", ";VAR2

Just to note if you ever need it. using a comma acts like a TAB, so say you have a table of data you wanted to print out. Rather than using LOCATE for each one to align each table cell, just use TAB for each one.

PRINT TABLE(0),TABLE(1),TABLE(2)

You can adjust the maximum number of spaces the TAB area occupies by changing the system variable TABSTEP, which ranges from 0 to 16

Edited on by Discostew

Discostew

3DS Friend Code: 4425-1477-0127 | Nintendo Network ID: Discostew

steriaca

Congradlations @bluerobin2 , @changev , and eveybody else who sumited games and got chosen for the SmileBloom Japan contest.

Humm...I wondere how Zombie Horde would of faired with the contest. Well, I did chicken out and sumited air (in other words, nothing), so why am I spectlating...

Anyways, @bluerobin2 , where is that website your working on, PtComunity?

My Friend Code is 3368-1310-0690.

randomous

@Discostew But @GeekDude was talking about the scrolling effect when printing to the bottom line, not the general carriage return placement at the end of a print statement:

"Any way to print to the console without having it scroll on the bottom line?"

Also, I have a question @Bluerobin2 @ramstrong ... Why didn't we just use the Wiki page to post tutorials? It's already nicely formatted, and it would have been pretty easy to add pages. Was there any particular reason?

Edited on by randomous

randomous

Nitras

Umm... anyone looking at my program on the last page?

Nitras

Pixelrobin

@randomous I believe I quote @morphtorok here: Its not that fun. Anyways we want a site not just for tutorials but instant help, game reviews, and pretty much a place where we could be the bosses . I'll still post on the Wiki but only for games and stuff. Mainly, PTCommunity (Working title) will be a place where people can submit questions and others can answer it to the world. We could even hold livestreams. There is a huge amount of possibilities when starting from scratch.

@steriaca A test website exists, But the final site will be on a completely different account that the admins could somehow access.

@ramstrong Once I start on the 'Final draft' as they say, I'll need your Blogger skills. Can you make it look nice? I'm sure you have some ideas.

@Nitras sorry, but no. Our computer needs to be fixed and I'm on my 3ds right now.

Edited on by Pixelrobin

Everybody do a chirp. CHIRP.

3DS Friend Code: 3007-9228-5126

Discostew

@randomous - Isn't that what he was trying to prevent? The scrolling effect when printing on the bottom line? PRINT statements attach a carriage return to the end of each statement to allow it to move to the next line, which if it is at the very bottom, it scrolls everything up so it can print on what is now the bottom line. Using a semi-colon prevents the adding of the carriage return so it continues on the same line for following print statements (unless of course you print at the very bottom-right corner, to which it bleeds to the next line).

I was able to increase the boundary height of his snake game by 2 by adding semi-colons to his print statements in that subroutine.

Edited on by Discostew

Discostew

3DS Friend Code: 4425-1477-0127 | Nintendo Network ID: Discostew

randomous

@Discostew Ohhh, I see. I guess I didn't read your post very well, I'm sorry. Cool, I didn't know this.

@Bluerobin2 Ahh, always gotta factor in the fun!

Edited on by randomous

randomous

Fadeintodust

I don't know if this has already been answered, but can someone explain to me how "AND" works when used for controls?

Fadeintodust

Discostew

Fadeintodust wrote:

I don't know if this has already been answered, but can someone explain to me how "AND" works when used for controls?

The state of the controls are stored in the BUTTON function. Each button represents a different values based on the power of 2

Up ~ 1 = 2^0 = BIT0
Down ~ 2 = 2^1 = BIT1
Left ~ 4 = 2^2 = BIT2
Right ~ 8 = 2^3 = BIT3
A ~ 16 = 2^4 = BIT4
B ~ 32 = 2^5 = BIT5
X ~ 64 = 2^6 = BIT6
Y ~ 128 = 2^7 = BIT7
L ~ 256 = 2^8 = BIT8
R ~ 512 = 2^9 = BIT9
Start ~ 1024 = 2^10 = BIT10

Because of the values they are assigned, you are able to mix them all into one value. Up equals 1, right equals 4, Up+right equals 1+4 = 5. This is because each button represents a "bit" in the overall value, and AND helps extract only those bits you designate. For instance. You retrieve a value of 5 from BUTTON(0). This represents Up+Right as said previously, but in order to check the individual states, use AND like so...

VAR1 = BUTTON(0)
IF VAR1 AND 1 THEN PRINT "Up was pressed"
IF VAR1 AND 4 THEN PRINT "Right was pressed"

In a special case where you want to, say, check if both Up and Right were pressed together, you'd have to change the form a little to....
IF (VAR1 AND 5)==5 THEN PRINT "Up+Right were pressed"

This is because any value returned that does not equal 0 is considered "true", so if you pressed only up, and did the line (VAR1 AND 5), it would return 1, which is not 0, so it equals "true. So the line above extracts only the bits representing Up+Right, then checks to see if both are actually pressed. You didn't need to do this with the other lines previously because you'd only get 2 results. Either 0, or the number you were ANDing, so "false" and "true", whereas 5 could have 4 different values - 0, 1, 4, 5 (or false, true, true, true).

Essentially, if you pressed every single button allowed (if possible), you'd get a value that equals 1+2+4+8+16+32+64+128+256+512+1024, or 2047 altogether.

Discostew

3DS Friend Code: 4425-1477-0127 | Nintendo Network ID: Discostew

Pixelrobin

I have begun work on a mining minigame. So far, I have completed a terrain generator with a really neat looking loading bar. Not bad for doing it ar 2 in the morning.

Everybody do a chirp. CHIRP.

3DS Friend Code: 3007-9228-5126

TexMurphy

With the buttons on the D pad you will also notice that the binary only changes one bit at a time. This prevents two buttons being read by the computer as it switches between them. Its called gray code. That is why the numbers are not in order around the D pad. You can get other numbers by combining two buttons. Like up arnd right, etc.

Edited on by TexMurphy

TexMurphy

Pixelrobin

Could someone explain how the advanced GPAGE works? I could never get that to do what I intend to.

Everybody do a chirp. CHIRP.

3DS Friend Code: 3007-9228-5126

randomous

@Bluerobin2 So, let's say you want to draw some stuff on the lower screen. You'd use GPAGE 1, then start drawing stuff, right? But let's say you want to be able to draw in the background so the user can't see it yet, but still have other graphics being displayed. This is basically what the advanced GPAGE does: it allows you to access 4 different pages for drawing graphics, and allows you specify which page you want your drawing commands to go to and which page you want to be displayed. For instance, let's say I have the command

GPAGE 1, 0, 0

This tells the program that you want to use the lower screen (1), draw on page 0, and show page 0. This is similar to your everyday graphics usage, the user will see what you draw as you draw it. However, look at this command:

GPAGE 1, 2, 0

Now I'm telling the program to draw on page 2, but show the user page 0. This way, the user won't see what you're drawing, because they're looking at a (presumably) empty page. Then, after you draw, you might do something like this:

GPAGE 1, 2, 2

Now you're letting the user look at what you drew, and if you draw any more, they'll see it right away. Each page is separate, so if you draw on one, it won't affect the others at all. When you want to save a graphic on a certain page, you have to append the page to the GRP:

SAVE "GRP2:LALALA"

Hope that helps!

Edited on by randomous

randomous

Pixelrobin

@randomous Thank you! But can I make it so if the top page has a transparent color, you would see the bottom one?

Everybody do a chirp. CHIRP.

3DS Friend Code: 3007-9228-5126

Please login or sign up to reply to this topic