DSiWare Forum

Topic: Petit Computer

Showing 181 to 200 of 9,299

AuthorMessage
Avatar

Late

181. Posted:

@Morphtroid: Thanks for the answers. I'd like to make a little game using capture mechanics from Ranger but as I thought it would take time and I wouldn't have the skills even after a year of practicing. Glad to see it's still possible at least in theory.

I have one more question to ask. Can you use both screens in your game or are you limited to just one and how does it work? By working I mean, do you have to have some kind of line to set the things to happen on top screen and then use another line to get things on bottom screen? Not really sure how whole programming works with this thing.

3DS FC: 3566-1647-7196
My Backloggery
My Pullblox puzzles
Be kind and feed my Pokémon :)

3DS Friend Code: 3566-1647-7196

AuthorMessage
Avatar

ShawnWilson

182. Posted:

I can't wait for Petit Farm man. I am excited. I think your the only one that has anything interesting going on.

ShawnWilson

AuthorMessage
Avatar

moomoo

183. Posted:

Hey guys! I was able to figure out how to make a C note play in the game! Yeah, I've made no progress in my music making. But the fact that playing a C is that rewarding says something.
Also, Petit Farm looks awesome. Keep it up.

Edited on by moomoo

Best thread ever
Feel free to add me on Miiverse or PSN.
Miiverse is Moomoo14, PSN is Moomoo1405390

3DS Friend Code: 4940-5561-6002 | Nintendo Network ID: Moomoo14

AuthorMessage
Avatar

Taya

184. Posted:

I am legit excited for Petit Farm. It's so beautifully Harvest Moon.

Taya

AuthorMessage
Avatar

Moorpheel

185. Posted:

@everyone: thanks :D

@late: All the graphical "layers" (but the console) have 2 "pages".
Page 0 is the top screen
Page 1 is the bottom screen.

For example
GPAGE 0
GFILL 0,0,255,191,COLOR
GPAGE 1
GFILL 0,0,128,191,COLOR

Will fill the top screen with a solid color (stored in the COLOR variable) AND fill half of the touch screen with the same color.

Other graphical layers have their own PAGE commands

So, in a way you can only work with a screen at a time, but it's so fast you won't notice it.

Edited on by Moorpheel

Moo

Oh look! A Morphloggery.
Oh! eShop Gurus.

3DS Friend Code: 0173-1330-0080 | Nintendo Network ID: Abgarok

AuthorMessage
AvatarAdmin

theblackdragon

186. Posted:

@Morphtroid, @bulbasaurusrex: between the two of you, thanks for the idea — i thought that i had to use the $ after things because it'd been used when I DIM'd the array, so i toggled it on and off depending on what i was fiddling with, and it worked fine up until this point. i'd already tried changing all the 'A's to 'A$'s instead but that didn't work at all, lol ('type mismatch' errors and syntax errors depending on which ones i fiddled with and which ones i didn't) so just now I tried changing all the 'A$'s to 'A's instead (aside from the DIM line) and whaddayaknow, it finally works, and for reals this time. hooray!
in the future, would QR codes be better if i'm trying to explain how i'm stuck? lol D:

@Morphtroid: that makes sense re: only being able to use one screen at a time — i'm wanting to say i remember reading an article where someone being interviewed said they had to work around the same thing with actual 'ware and retail titles, so it's not just a limitation of Petit Computer i don't think.

Edited on by theblackdragon

BEST THREAD EVER
future of NL >:3
[16:43] James: I should learn these site rules more clearly
[16:44] LztheBlehBird: James doesn't know the rules? For shame!!!
[16:44] Vintage: We have rules?
[16:44] Reala: don't expose the staff to sunlight, don't get them wet and don't feed them after midnight

3DS Friend Code: 3136-6802-7042 | Nintendo Network ID: gentlemen_cat | Twitter: theblackdragon

AuthorMessage
Avatar

Moorpheel

187. Posted:

Well you see,you were trying to store numbers on an alphanumerical variable and comparing them to real numbers without using VAL

QR codes would be nice but it would be a bother for you, so don't worry.

Edited on by Moorpheel

Moo

Oh look! A Morphloggery.
Oh! eShop Gurus.

3DS Friend Code: 0173-1330-0080 | Nintendo Network ID: Abgarok

AuthorMessage
Avatar

TheDreamingHawk

188. Posted:

Could someone teach me how to do an input command? I do it like this and I get an error

INPUT "Are you happy?"

Then it turns into an error.

A Supporter of Reggie Fils-Aime and Respectful opinions
Pokemon black 2 FC: 1808 0259 1596

3DS Friend Code: 4725-7951-6337 | Nintendo Network ID: TheDreaminHawk

AuthorMessage
Avatar

Moorpheel

189. Posted:

You need a variable to store the input.

Example
INPUT "tell me a number";VAR

INPUT "tell me your name";VAR$

Moo

Oh look! A Morphloggery.
Oh! eShop Gurus.

3DS Friend Code: 0173-1330-0080 | Nintendo Network ID: Abgarok

AuthorMessage
Avatar

JohnDoe123

190. Posted:

@TheDreamingHawk What are you trying to input? The INPUT command is, as far as I know, used for the user input of variables. As an example, If you wanted the answer to "Are you happy?" as a variable, you could do:
PRINT "Are You Happy?"
INPUT A$
PRINT A$

What that does is ask the user to input a variable called A$. The answer would be in a text form, so I believe you need to do a single letter followed by $ for a numerical variable, you could use just text as a variable name, for example, HISCORE. Then the last PRINT command shows you the variable. I think that would work, but I could be wrong. Ans the first and last lines are unnecessary, you could do it with just INPUT A$. Hopefully that was clear.

Edit: or I guess Morphoid's way is easier.

Edited on by JohnDoe123

JohnDoe123

3DS Friend Code: 0259-0286-9394

AuthorMessage
Avatar

Peidorrento

191. Posted:

I'm working on a "petit invaders" but I still can't figure out the best way to update graphics (kinda nooby thing, I guess). I mean, how can I update positions without having that blinking "effect"? I know it might have something to do with "vsync" and all the pages, but I can't undestand exactly how it works. Little help? :$

"A vingança nunca é plena, mata a alma e a envenena" - Seu Madruga
Presidente, CEO, Programador e único empregado da Peidosoft.

AuthorMessage
Avatar

JohnDoe123

192. Posted:

How can I get sprites to move from point A to point B with out them teleporting there?

JohnDoe123

3DS Friend Code: 0259-0286-9394

AuthorMessage
Avatar

Nintenbro

193. Posted:

@EmpireIndustries, I have no knowledge of the BASIC language, but your issue seems fairly obvious to me. That is, if I'm thinking correctly. I would say you need to add more than two points. If you only input two points, the program probably believes there are only two points.

Nintendo Bro
3DS FC: 3222-6658-7489

Currently waiting for Luigi's Mansion: Dark Moon & Castlevania: Lords of Shadow - Mirror of Fate

AuthorMessage
Avatar

JohnDoe123

194. Posted:

@Nintenbro Hmm. I'll see if there's something I can do along those lines. Thanks!

JohnDoe123

3DS Friend Code: 0259-0286-9394

AuthorMessage
Avatar

DrKarl

195. Posted:

EmpireIndustries wrote:

How can I get sprites to move from point A to point B with out them teleporting there?

Move them a few pixels at a time. Petit Computer gives you 8 registers for each sprite I believe. You can store whatever you want in these. For example, you could store the current position x, y in registers 0 and 1, and the destination x, y in 2 and 3. Then you can run this simple program to demonstrate:

CLS
CLEAR
SPCLR

FOR I = I TO 99
SPSET I,RND(511),0,0,0,1,16,16

X = RND(255)
Y = RND(191)

SPSETV I,0,X
SPSETV I,1,Y
SPSETV I,2,RND(255)
SPSETV I,3,RND(255)

SPOFS I,X,Y

NEXT

@ANIMATE_START

DONEANIMATING = TRUE
FOR I = 0 TO 99

'Get current sprite location
CURRENTX = SPGETV(I,0)
CURRENTY = SPGETV(I,1)

'Get current sprite destination
DESTX = SPGETV(I,2)
DESTY = SPGETV(I,3)

'Move one pixel to the left or right depending on location of destination
IF DESTX < CURRENTX THEN CURRENTX = CURRENTX - 1
IF DESTX > CURRENTX THEN CURRENTX = CURRENTX + 1

'Move one pixel up or down depending on location of destination
IF DESTY < CURRENTY THEN CURRENTY = CURRENTY - 1
IF DESTY > CURRENTY THEN CURRENTY = CURRENTY + 1

'position the sprite
SPOFS I, CURRENTX, CURRENTY

'store the new position in the sprite registers
SPSETV I,0,CURRENTX
SPSETV I,1,CURRENTY

'check to see if sprite is in final location
IF CURRENTX != DESTX OR CURRENTY != DESTY THEN DONEANIMATING = FALSE
NEXT
VSYNC 1

IF DONEANIMATING == TRUE THEN GOTO @ANIMATE_DONE
GOTO @ANIMATE_START

@ANIMATE_DONE

Edited on by DrKarl

DrKarl

AuthorMessage
Avatar

JohnDoe123

196. Posted:

@DrKarl Ok, Thanks.
I'm almost finished my first really awful game now. Just a few more questions.
Is there a way to remove the sound that plays when you load a sprite or background in-game?
How exactly does GOSUB work? I'm getting an error with sprite collision, and I think it might have something to do with GOSUB, not sure if I'm using it correctly.
Thanks in advance!

JohnDoe123

3DS Friend Code: 0259-0286-9394

AuthorMessage
Avatar

DrKarl

197. Posted:

I'll get back to you on Gosub soon. To suppress the loading sound & the loading confirmation screen:

SYSBEEP = FALSE
LOAD "SPU0:FILENAME", FALSE
SYSBEEP = TRUE

As you probably know, the SPU0 will be whatever you are loading, I think it is BGU0 and BGU1 for backgrounds. Also, I turn the beep back on after doing the load, which is optional depending if you want it back on or not.

DrKarl

AuthorMessage
Avatar

DrKarl

198. Posted:

GOSUB is THE most powerful tool in a BASIC programmers toolkit. It will allow you to create a solid foundation on which to build your programs.

At its most simplest, GOSUB can be viewed as a fancy GOTO.

For example, consider this very simple program:

X=5
Y=10

PRINT "X is"

IF X < Y THEN GOTO @LESS ELSE GOTO @GREATER

@RETURNPOINT
PRINT "THAN Y"
END

@LESS
PRINT "LESS"
GOTO @RETURNPOINT

@GREATER
PRINT"GREATER"
GOTO @RETURNPOINT


Using Gosubs, we are able to eliminate the @RETURNPOINT label, and make things a bit more uniform:
X=5
Y=10

PRINT "X is"

IF X < Y THEN GOSUB @LESS ELSE GOSUB @GREATER

PRINT "THAN Y"
END

@LESS
PRINT "LESS"
RETURN

@GREATER
PRINT"GREATER"
RETURN

See the difference? Code reached by a GOSUB must always begin with a @Label and end with a RETURN. When the line with RETURN is reached during the execution of a program, the program automatically does a GOTO to the point where the GOSUB was called. This makes that block of code very reusable. Anywhere in your code, you can do a GOSUB to that code block and know that when it finishes that block of code it will return to the location in code right after the GOSUB was called.

Does this make sense? I will leave it simple like this for now. However, GOSUB is much, much more powerful still. HINT: GOSUBS can be nested. I can provide an example in the future if anyone would like.

Edited on by DrKarl

DrKarl

AuthorMessage
Avatar

JohnDoe123

199. Posted:

@DrKarl Thanks a lot! That makes sense now, I was using GOSUB in the wrong way.

JohnDoe123

3DS Friend Code: 0259-0286-9394

AuthorMessage
Avatar

KAHN

200. Posted:

am i the only one around here who can't figure out how to place and move a sprite?

KAHN

3DS Friend Code: 1032-1301-2772 | Nintendo Network ID: Milkman12