DSiWare Forum

Topic: Petit Computer

Showing 1,541 to 1,560 of 9,296

AuthorMessage
Avatar

Credible

1,541. Posted:

I need some more help. I have an array with dimensions of 16 and 12 (DIM 16,12). In this array, Walls are assigned W and open spaces are assigned 0.
I also have a small arrow sprite (SPSET 0,1,0,0,0,0) that moves with the Directional Pad. When this sprite touches a W, I need it to not be able to proceed. You know, just like walls in real life. Here's an example of the code I'm using:
CLS:CLEAR
RESTORE @MAPDATA
DIM MAP(6,6)
FOR X=0 TO 6
FOR Y=0 TO 6
READ MAP(X,Y)
NEXT
NEXT
FOR X=0 TO 5
FOR Y=0 TO 5
LOCATE X,Y
IF MAP(X,Y)==0 THEN LOCATE X,Y:? "0"
IF MAP(X,Y)==1 THEN LOCATE X,Y:? "W"
NEXT
NEXT
SPSET 0,1,0,0,0,0
@LOOP
SPOFS 0,X,Y
'D Pad controls stuff here, leaving it out
VSYNC 1:GOTO @LOOP

@MAPDATA
DATA 1,1,1,1,1,1
DATA 1,0,0,0,0,1
DATA 1,0,0,0,0,1
DATA 1,0,0,0,0,1
DATA 1,0,0,0,0,1
DATA 1,1,1,1,1,1

This creates a small room with the arrow sprite in it. So how do I make it stop at collisions with W's?

Edited on by Credible

Credible

AuthorMessage
Avatar

petiSnail

1,542. Posted:

Credible wrote:

I need some more help. I have an array with dimensions of 16 and 12 (DIM 16,12). In this array, Walls are assigned W and open spaces are assigned 0.
I also have a small arrow sprite (SPSET 0,1,0,0,0,0) that moves with the Directional Pad. When this sprite touches a W, I need it to not be able to proceed. You know, just like walls in real life. Here's an example of the code I'm using:
CLS:CLEAR
RESTORE @MAPDATA
DIM MAP(6,6)
FOR X=0 TO 6
FOR Y=0 TO 6
READ MAP(X,Y)
NEXT
NEXT
FOR X=0 TO 5
FOR Y=0 TO 5
LOCATE X,Y
IF MAP(X,Y)==0 THEN LOCATE X,Y:? "0"
IF MAP(X,Y)==1 THEN LOCATE X,Y:? "W"
NEXT
NEXT
SPSET 0,1,0,0,0,0
@LOOP
SPOFS 0,X,Y
'D Pad controls stuff here, leaving it out
VSYNC 1:GOTO @LOOP

@MAPDATA
DATA 1,1,1,1,1,1,1
DATA 1,0,0,0,0,0,1
DATA 1,0,0,0,0,0,1
DATA 1,0,0,0,0,0,1
DATA 1,0,0,0,0,0,1
DATA 1,1,1,1,1,1,1

This creates a small room with the arrow sprite in it. So how do I make it stop at collisions with W's?

I don't know, but one thing I can tell you is that the size of your array declaration (6x6) is different from the nested loop (7x7)* and the DATA (7x6). They need to be the same before you can get desirable results. Also, make the outer loop of the nested loop Y and the inner one X.

As for the collision logic, I think the idea is to test the area ahead for a wall before proceeding.
Something like :
IF (BUTTON(2) AND 8) AND MAP (X+1,Y) != 1 THEN PLAYERX=PLAYERX+1

*not a typo, FOR X=0 TO 6 is inclusive so it has needs 7 elements in an array (DIM MAP(7,7)

Edited on by petiSnail

petiSnail

AuthorMessage
Avatar

Credible

1,543. Posted:

@petiSnail
Sorry about that, I was editing the array data to make the post smaller.
I tried your collision idea like this:
IF (BUTTON(0) AND 1) AND MAP (X,Y-1) != 1 THEN Y=Y-1

However, this prevents me from moving up at all, even if I'm outside the room. I feel like I'm getting close, though!

Edited on by Credible

Credible

AuthorMessage
Avatar

petiSnail

1,544. Posted:

Credible wrote:

@petiSnail
Sorry about that, I was editing the array data to make the post smaller.
I tried your collision idea like this:
IF (BUTTON(0) AND 1) AND MAP (X+1,Y) != 1 THEN Y=Y-1

However, this prevents me from moving up at all, even if i'm outside the room. I feel like I'm getting close, though!

you are close:
(X+1,Y) should be (X, Y-1)

Remember to check in the direction you're headed.

Edited on by petiSnail

petiSnail

AuthorMessage
Avatar

Credible

1,545. Posted:

petiSnail wrote:

@petiSnail
you are close:
(X+1,Y) should be (X, Y-1)

Remember to check in the direction you're headed.

Right, sorry, noticed that, fixed it in my old post, but even this:
IF (BUTTON(0) AND 1) AND MAP (X,Y-1) != 1 THEN Y=Y-1
Prevents me from moving up no matter what.

Edited on by Credible

Credible

AuthorMessage
Avatar

Hairmanban19

1,546. Posted:

swordx wrote:

@Hairmanban19 Check the QR code thread for your answer. Thanks for the support, I really appreciate it!

Your welcome.Since i like the beta you made for Dungeon adventure,then i am sure i will love the full version since there is a town and sidequests and other things that i do not know about.

Nintendo ID: Hairmanban19. Working on a secret PTC project... If you're wondering why the knight in my profile pic has a shovel, here is the explanation: http://yachtclubgames.com/shovel-knight/

3DS Friend Code: 3136-7615-5907

AuthorMessage
Avatar

Linput

1,547. Posted:

Well, I'm back. Been playing Pokemon a little too much. ANYWAYS I am looking for people to help me with Sally. look in my signature to see what u can do!

Linput-3DS friend code: 4725-8494-2702
Pokemon White 2 pal-pad code: 1979 9213 55

I'm currently looking for some peeps to make SALLY a website, facebook, and email. If anyone does this u will be mentioned as a producer in the SALLY OS credits! :)

AuthorMessage
Avatar

Hairmanban19

1,548. Posted:

Does anybody know some websites with good petit computer tutorials cause i cant learn much from any of the websites i know?

Nintendo ID: Hairmanban19. Working on a secret PTC project... If you're wondering why the knight in my profile pic has a shovel, here is the explanation: http://yachtclubgames.com/shovel-knight/

3DS Friend Code: 3136-7615-5907

AuthorMessage
Avatar

Credible

1,549. Posted:

hairmanban19 wrote:

Does anybody know some websites with good petit computer tutorials...

One of the best ways to learn code is to look at some. Scan the QR's for some more simple programs and study them. See what commands do, and mess around with some of their values to see what effects it will have. Then, you should write your own program using what you learned to help get it set in, and to prove to yourself that you really do understand what you're doing. Also, Petit Professor has a good set of videos to learn things. http://www.youtube.com/user/PetitProfessor

Credible

AuthorMessage
Avatar

Hairmanban19

1,550. Posted:

Thank you.

Nintendo ID: Hairmanban19. Working on a secret PTC project... If you're wondering why the knight in my profile pic has a shovel, here is the explanation: http://yachtclubgames.com/shovel-knight/

3DS Friend Code: 3136-7615-5907

AuthorMessage
Avatar

ZombieChiggers

1,551. Posted:

...sigh... so bored...

Cameron Stover VVVVVVVVVVVVVV ALSO VVVVVVVV and i like trains (BOOM!) also minecraft and trollface!
INFECTED. NEW ZOMBIE

3DS Friend Code: 4854-7026-5042

AuthorMessage
Avatar

ramstrong

1,552. Posted:

Credible wrote:

petiSnail wrote:

@petiSnail
you are close:
(X+1,Y) should be (X, Y-1)

Remember to check in the direction you're headed.

Right, sorry, noticed that, fixed it in my old post, but even this:
IF (BUTTON(0) AND 1) AND MAP (X,Y-1) != 1 THEN Y=Y-1
Prevents me from moving up no matter what.

You may have to repost your corrected code, but before you do, please check that you're not confusing wall/character coordinates, which goes 32x24, and sprite/screen coordinates, which goes 255x191.

As well, don't use the same variable names on both. Try MAPX,MAPY AND SCREENX,SCREENY. I'd probably use MX,MY and SX,SY because I'd be too lazy to type out the full name, but it does get confusing after a while.

snoremac wrote:

...sigh... so bored...

You need help, but not from this thread. Why don't you find a thread where people have fun? Please stop posting irrelevant topics.

Edited on by ramstrong

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

AuthorMessage
Avatar

Bluerobin2

1,553. Posted:

I am currently working on Battlewood's bottom screen, where you will be able to access power-ups and such from the bottom screen. I was wondering, is there a way to make your own panel buttons for the bottom screen? If not, Is there a way to make your own custom backgrounds? All of my trials failed. BTW I have figured out how to display a grp on the bottom screen quite by accident. Here is how:
LOAD "GRP1:NAMEHERE"
notice the ”1” next to GRP. Lol I thought those numbers worked like sprites :D. I do not need it now thanks to the awesome @morphtroid who told me about bgpage. Thanks!
@linput14 what is "SALLY” stand for? and will it be for PTCOM? Welome back! (this is the first time I saw that you existed but welcome back netherless) ;)

Houston, We have a Syntax Error.

Blog: bluerobin2.blogspot.com
Backloggery: backloggery.com/bluerobin2

3DS Friend Code: 3007-9228-5126

AuthorMessage
Avatar

Bluerobin2

1,554. Posted:

oh yeah, really quick, who uses ptcomp on a 3ds? Who uses it on a dsi?

Houston, We have a Syntax Error.

Blog: bluerobin2.blogspot.com
Backloggery: backloggery.com/bluerobin2

3DS Friend Code: 3007-9228-5126

AuthorMessage
Avatar

Moorpheel

1,555. Posted:

@Bluerobin2: I use my 3DS XL

Moo

Oh look! A Morphloggery.
Oh! eShop Gurus.

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

AuthorMessage
Avatar

Discostew

1,556. Posted:

Using PTC on my 3DS

"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

Sprite

1,557. Posted:

3DS

I'm not saying let's kill all the stupid people, I'm just saying let's take off the warning labels, and see what happens. Friend Code: 1075-1228-4183

AuthorMessage
Avatar

Linput

1,558. Posted:

bluerobin2 wrote:

I am currently working on Battlewood's bottom screen, where you will be able to access power-ups and such from the bottom screen. I was wondering, is there a way to make your own panel buttons for the bottom screen? If not, Is there a way to make your own custom backgrounds? All of my trials failed. BTW I have figured out how to display a grp on the bottom screen quite by accident. Here is how:
LOAD "GRP1:NAMEHERE"
notice the ”1” next to GRP. Lol I thought those numbers worked like sprites :D. I do not need it now thanks to the awesome @morphtroid who told me about bgpage. Thanks!
@linput14 what is "SALLY” stand for? and will it be for PTCOM? Welome back! (this is the first time I saw that you existed but welcome back netherless) ;)

Thanks for the welcome! I have been on this forum for about a year, so I'm surprised u haven't seen me before. SALLY doesnt stand for anything, its just my OS (Operating Sysytem). And yes< it is for PTC.

Linput-3DS friend code: 4725-8494-2702
Pokemon White 2 pal-pad code: 1979 9213 55

I'm currently looking for some peeps to make SALLY a website, facebook, and email. If anyone does this u will be mentioned as a producer in the SALLY OS credits! :)

AuthorMessage
Avatar

Bluerobin2

1,559. Posted:

Linput14 wrote:

Thanks for the welcome! I have been on this forum for about a year, so I'm surprised u haven't seen me before. SALLY doesnt stand for anything, its just my OS (Operating Sysytem). And yes< it is for PTC.

Well I started posting here a month and a half ago I believe... :)

Houston, We have a Syntax Error.

Blog: bluerobin2.blogspot.com
Backloggery: backloggery.com/bluerobin2

3DS Friend Code: 3007-9228-5126

AuthorMessage
Avatar

damolii

1,560. Posted:

@bluerobin2 Dsi!!! I have had mine for 4 years.

Edited on by damolii

I don't have a 3DS so what do I put here? -Damolii