DSiWare Forum

Topic: Petit Computer

Showing 6,581 to 6,600 of 9,524

AuthorMessage
Avatar

ShadowGame

6,581. Posted:

Hello,
i would ask somethings about Petit Computer.
I would make a shot if you press the touchscreen, but it doesnt work. Here the code:
My code set the variable "move" to R,L,U and D and if the touchscreen is pressed, then it
goes to @TCH

Here is the rest of the code for this:

IF MOVE==L THE GOSUB @L ELSE THEN
IF MOVE==R THEN GOSUB @R ELSE THEN
IF MOVE==U THEN GOSUB @U ELSE THEN
IF MOVE==D THEN GOSUB @D ELSE THEN GOSUB @LOOP RETURN
@R
Then comes SPSET, SPOFS And after this how it must move
(the right shot must move to the right and so on)

The problem: It always go to @L. When i write IF MOVE==R in the first line on then it goes
to @R. Why it always uses the first one?

Question 2:
How can i make that sprites are on the touchscreen? I know how to make with backgrounds but not with sprites.

Question 3:
How can i load own sprites? I know: LOAD "SPU0:FILENAME" but that only loads the sprite... How can i blit it on the screen

Please help me. The first question is the importantst for me.

Edited on by ShadowGame

ShadowGame

AuthorMessage
Avatar

GraphicGenius

6,582. Posted:

twinArmageddons wrote:

@programmerpro maybe you should start working on the main gameplay

I was asking @Pootrick2 but you can join the team if you want.

If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens. Wait was that just a joke?

3DS Friend Code: 1478-3545-5136 | Nintendo Network ID: GreatGamer123

AuthorMessage
Avatar

BonChoi

6,583. Posted:

IAmAPerson wrote:

Sorry for double post, but how do you draw in different shades of a colour? Like light red, red, and dark red without having to use different colour IDs. Something like 3A, 3B, and 3C?

I was annoyed by that when coding textures for Minecraft DS back when it was still in alpha :/
There would be a certain color I'd want and it would be like 4F. I'd type that into the data and it would give me a type mismatch error.

Programmer for Minecraft DS!

Press B!

AuthorMessage
Avatar

InsertPi

6,584. Posted:

Shhhh.... This is what it looks like with my inventory open. With it closed, it looks like this without the "Please choose a block" and the block selection.
Untitled
What's that you say? Since the DS doesn't support multi-touch you can't press walk and dash at the same time? I've found a way where you can, don't worry.

If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens.

3DS Friend Code: 2148-9259-0831 | Nintendo Network ID: IAmAPerson620 | Twitter: @PhilLovesPi

AuthorMessage
Avatar

mystman12

6,585. Posted:

@ShadowGame Could you post the code that changes the variable? I don't see anything wrong with what you posted, so I need to see more. You can create your own sprites in the CHRED program. Once you've created and saved your sprites, you can load them into the game with code like this: LOAD "SPU#:FILENAME" (Or BGU#:FILENAME for background tiles. You can select which type of sprite you want to use with the 3 buttons to the right of the sprite editor.) You need to place a number in the # spot. That tells the program which page to load the file into, (It works something like that, someone please correct me if I'm wrong.) and it's best to load it into the same page number as the one you used while creating the sprites(The numbers under the sprite editor let you select which page you want to use) As for loading sprites on the bottom screen, I really don't know yet. I hope this helps!

I don't believe it! I won't believe it! There isn't a pinball right here! What kind of world do we live in, where there isn't a pinball right here? Well, I'm going to do my part! I'm gonna— umm... build a pinball! - Homestar Runner (Sort of)
Future Pinball blog
Infinite Office for PTC!

3DS Friend Code: 0259-0292-5888 | Nintendo Network ID: mystman12 | Twitter: mystman12

AuthorMessage
Avatar

ShadowGame

6,586. Posted:

Thanks mystman12!
I found another way to solve that was i explained at question 1, but now i have another problem.
I made that the player only can go 20 steps and if the steps are at 0 then you lose.
Now i would program this, but i got an error if i type this in:

@LOOP
IF STEPS==0 THEN GOTO @LOSE ELSE THEN GOTO @LOOP2 RETURN

What is wrong?

PS: It works to set STEPS -1

Thanks

ShadowGame

AuthorMessage
Avatar

InsertPi

6,587. Posted:

@ShadowGame I see you're doing

IF STUFF THEN STUFF ELSE THEN STUFF RETURN

If you're using ELSE, then you don't use another THEN after that

IF STUFF THEN STUFF ELSE STUFF

So you'd do

IF STEPS==0 THEN GOTO @LOSE ELSE GOTO @LOOP2

or for short

IF STEPS==0 THEN @LOSE ELSE GOTO @LOOP2

I don't know what you want the RETURN to do. Is it like an END IF, cause that's not required in this language. Have you programmed in other languages in the past? This reminds me of a few other languages I've used before.

Also, I saw before that you did

IF MOVE==U...

MOVE in this case is a variable. If you're using the D-pad, then you would use

IF BUTTON() AND 1 THEN...

This means that if up is pressed, it'll execute whatever is after the THEN. 2 is down, 4 is left, 8 is right, and it continues like this from A, B, X, Y, L, R, START, and SELECT, doubling each time. If you want MOVE as a string, then you'd use

IF MOVE$=="U" THEN...

A $ after the variable indicates that it's a string.

If you have anymore questions, just ask!

Edited on by InsertPi

If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens.

3DS Friend Code: 2148-9259-0831 | Nintendo Network ID: IAmAPerson620 | Twitter: @PhilLovesPi

AuthorMessage
Avatar

ShadowGame

6,588. Posted:

Thanks!!!
And yes i have got another question:
How can i make that the enemy sporn on a random place?
I used:
SPAWN=RND(3)
IF SPAWN==1 THEN RETURN
And then i used SPSET, SPOFS and SPANIM.

But there is always an error:
RETURN WITHOUT GOSUB
and when i added Gosub there was an error that GOSUB is wrong...

I used the code from the game WIZARD.

Please Help!
Thanks

ShadowGame

AuthorMessage
Avatar

mystman12

6,589. Posted:

@ShadowGame It sounds like you're putting a RETURN command somewhere that isn't in a GOSUB. RETURN should only be used when you use the GOSUB command, like this:

GOSUB @YAY
Print " AWESOME"

@YAY
PRINT" THIS IS "
RETURN

This code will print THIS IS AWESOME on the screen. What's happening is the when the program gets to the GOSUB command it travels to the @YAY. Once it hits RETURN, it goes back to the GOSUB and starts reading code from there. I hope this helps!

Edited on by mystman12

I don't believe it! I won't believe it! There isn't a pinball right here! What kind of world do we live in, where there isn't a pinball right here? Well, I'm going to do my part! I'm gonna— umm... build a pinball! - Homestar Runner (Sort of)
Future Pinball blog
Infinite Office for PTC!

3DS Friend Code: 0259-0292-5888 | Nintendo Network ID: mystman12 | Twitter: mystman12

AuthorMessage
Avatar

ShadowGame

6,590. Posted:

OK, thanks.
But: In Wizard (a game that i have from petit computer wikia) is the same code and there it works....

ShadowGame

AuthorMessage
Avatar

InsertPi

6,591. Posted:

ShadowGame wrote:

In Wizard (a game that i have from petit computer wikia) is the same code and there it works....

Any game that has GOSUB and RETURN correctly then it'll work.

If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens.

3DS Friend Code: 2148-9259-0831 | Nintendo Network ID: IAmAPerson620 | Twitter: @PhilLovesPi

AuthorMessage
Avatar

Pootrick2

6,592. Posted:

@ProgrammerPro work on link moving around and the background moving when you go to another screen

Edited on by Pootrick2

I LOVE petit computer AND anything Zelda/Minecraft related (i own all zelda games)

3DS FC=0919-9700-5328

3DS Friend Code: 0919-9700-5328 | Nintendo Network ID: Pootrick2 | Twitter: Pootrick2ithink

AuthorMessage
Avatar

Discostew

6,593. Posted:

GOSUB should always precede RETURN in the code execution.

"What fun is there in making sense?"
Lazer Light Studios - Home of the MM2 PTC project

Pokemon 3DS Friend Safari - Ice - Spheal, Sneasel, Lapras

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

AuthorMessage
Avatar

ShadowGame

6,594. Posted:

Ok, thanks.
How can i make that the Enemy sprite Spawn on random places (or make a random that chooses 1 of 5 or more places)?

And how i can blit my own sprites on the screen?
I know how i can make them and i can Load them
but how can i blit them on the screen? And how can i blit sprites on the touchscreen (i know how i
can blit Backgrounds on the screen, but not how i Must so this with sprites)?
Thanks

Edited on by ShadowGame

ShadowGame

AuthorMessage
Avatar

Hairmanban19

6,595. Posted:

@Hansausage i really like your Duck Hunt game! :D

...

3DS Friend Code: 3136-7615-5907

AuthorMessage
Avatar

InsertPi

6,596. Posted:

What is you guys' LEAST favourite part of PTC programming? Mine is doing touch screen buttons. Making the touch controls for Minecraft DS is a NIGHTMARE!

If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens.

3DS Friend Code: 2148-9259-0831 | Nintendo Network ID: IAmAPerson620 | Twitter: @PhilLovesPi

AuthorMessage
Avatar

GraphicGenius

6,597. Posted:

You know what @Pootrick2 I'm just gonna work on the profile selection because it's gonna be a while before we start working on the actual game.

IAmAPerson wrote:

What is you guys' LEAST favourite part of PTC programming? Mine is doing touch screen buttons. Making the touch controls for Minecraft DS is a NIGHTMARE!

Yeah kinda the same thing for me. Also, I'm sorry I don't know much about MCDS. It's just that the last time I got the program was 5 or 6 updates ago! Do you have any link to the qr codes for the latest update?

Edited on by GraphicGenius

If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens. Wait was that just a joke?

3DS Friend Code: 1478-3545-5136 | Nintendo Network ID: GreatGamer123

AuthorMessage
Avatar

twinArmageddons

6,598. Posted:

IAmAPerson wrote:

What is you guys' LEAST favourite part of PTC programming? Mine is doing touch screen buttons. Making the touch controls for Minecraft DS is a NIGHTMARE!

what i do for touch screen controls is write this in the prg
CLS:?TCHX:?TCHY
and write down the coordinates and when im done i remove that line

get in loser we're going titan hunting

3DS Friend Code: 2879-0639-8952 | Nintendo Network ID: merp_aottg

AuthorMessage
Avatar

InsertPi

6,599. Posted:

@programmerpro http://petitcomputer.wikia.com/wiki/Minecraft_DS
@twinArmageddons I do that too, it's just so time consuming when you have a ton of buttons.

If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens.

3DS Friend Code: 2148-9259-0831 | Nintendo Network ID: IAmAPerson620 | Twitter: @PhilLovesPi

AuthorMessage
Avatar

iprice

6,600. Posted:

ShadowGame wrote:

Ok, thanks.
How can i make that the Enemy sprite Sporn on random places (or make a random that chooses 1 of 5 or more places)?

And how i can blit my own sprites on the screen?
I know how i can make them and i can Load them
but how can i blit them on the screen? And how can i blit sprites on the touchscreen (i know how i
can blit Backgrounds on the screen, but not how i Must so this with sprites)?
Thanks

To create a sprite at a random location you first have to load a sprite image file, then use SPSET to create a sprite, then use SPOFS to display it at the required location.

eg
ACLS
SPCLR

X=100
Y=100
SPSET 0,10,0,0,0,0
' 0=sprite number. Each new sprite needs to have a unique number
' 10 is the actual sprite graphic image number
' The first zero is the palette number. The other values are horizontal and vertical rotation values, then the layer of the screen. Optional parameters are size x and size y (8, 16, 32 etc.)

@LOOP

SPOFS 0,X,Y
' Draws sprite number zero at position 100,100 on the top screen

' If you want to draw a sprite on the bottom screen you need to use SPAGE 1 before using the SPOFS command. Be aware you can only draw system sprites on the bottom screen, not ones you've designed yourself IIRC

GOTO @LOOP
.
.
.
.
.
For a number of random sprites you can do something like this -

ACLS
SPCLR
CLEAR

GOTO @INIT

@INIT

DIM SPRITEX(10)
DIM SPRITEY(10)

FOR N=0 TO 9
SPRITEX(N)=RND(255)
SPRITEY(N)=RND(180)
SPSET N,10,0,0,0,0
NEXT

GOTO @LOOP

@LOOP

FOR N=0 TO 9
SPOFS N,SPRITEX(N),SPRITEY(N)
NEXT

GOTO @LOOP

That will create and display10 sprites all using sprite image number 10 at random positions on the top screen.

Edited on by iprice

I code, therefore I am.