DSiWare Forum

Topic: Petit Computer

Showing 2,601 to 2,620 of 9,549

AuthorMessage
Avatar

PixelRobin

2,601. Posted:

@mystman12 I looked over it, and I might make something similar thanks!

Everybody do a chirp. CHIRP.

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

3DS Friend Code: 3007-9228-5126

AuthorMessage
Avatar

damolii

2,602. Posted:

Good news guys!! Almost finished my minecraft music pack!!! I'm a bit behind on my actual game coding though. Cannot figure out what I am doing wrong :( It will be nice when it is finished though :)

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

AuthorMessage
Avatar

PixelRobin

2,603. Posted:

What happens when you save two programs with the same name to the SD card?

Everybody do a chirp. CHIRP.

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

3DS Friend Code: 3007-9228-5126

AuthorMessage
Avatar

randomous

2,604. Posted:

@Gimmemorecoinz I guess you didn't see my previous post (or didn't want to read it). That's fine, I figured I'd just post the code directly instead of linking you to the program that does exactly what you want to do. Here's the code:

DIM WORDS$(100)
I=0

PHRASE$="Words are nice man."

@LOOP
POS=INSTR(PHRASE$," ")
IF POS==-1 GOTO @END
WORDS$(I)=LEFT$(PHRASE$,POS)
I=I+1
PHRASE$=RIGHT$(PHRASE$,LEN(PHRASE$)-POS-1)
GOTO @LOOP

@END

IF LEN(PHRASE$) THEN WORDS$(I)=PHRASE$:I=I+1

Now, WORDS$ contains the various words that were in the string (in the order they were found). I is the number of words you found. The delimiter is only space, but you can change it to whatever you want. PHRASE$ is the string we're parsing. Basically what happens is: POS stores the location of the next space within the PHRASE$. It is -1 if there are no more spaces, so we jump out of the loop (GOTO @END). Then, we extract the word from the phrase using the LEFT$ command and store it into our array WORDS$. LEFT$ says take the number of letters from the left of the word (POS) and return them. Then we increment I to show that we found a word. The next line uses RIGHT$ to take a certain number of letters off from the right (in string order though) and return them. What I'm basically doing "removing" the word from the PHRASE$ by only retrieving the characters that are to the RIGHT$ of the word. Then we loop. At the end, if we don't have a space as the last character, we'll have a bit of stuff left over in phrase. It's the last word, so just get it. This is the "simple" way to do it, but I would suggest doing it character by character instead of word by word. If you do it character by character, it's easier to specify multiple delimiters and to throw out unwanted characters (such as periods).

randomous

AuthorMessage
Avatar

randomous

2,605. Posted:

Bluerobin2 wrote:

What happens when you save two programs with the same name to the SD card?

Did you delete one of them and then make a new one with the same name? Saving a program with the same name multiple times just appends a different number to the end of the file. For instance, I've saved a particular program 60 times, so the program has a 059 at the end of it. I'm pretty sure it'll do the same for yours, but it's better to be safe than sorry.

randomous

AuthorMessage
Avatar

ramstrong

2,606. Posted:

Bluerobin2 wrote:

What happens when you save two programs with the same name to the SD card?

Different programs go to different directories. Same program go to same directory, but with versioning at the end of it.

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

ramstrong

2,607. Posted:

Gimmemorecoinz wrote:

Discostew wrote:

Are you taking into account that mid$ returns a number between 0 and StringLength-1 inclusive, or -1 if it does not find a match?

I thought mid$ returned a true string.

It does. Discostew is describing INSTR, but he got the right idea. Counting is from 0.

You want string to array? It's trivial to modify my @ACT subroutine to do that. Now if you also want to remove duplicates, then it's not so easy. I did manage to get a version that does. But you just want a simple array, right?

Randomous method also works fine. In fact, I think it's better!

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

randomous

2,608. Posted:

ramstrong wrote:

Gimmemorecoinz wrote:

Discostew wrote:

Are you taking into account that mid$ returns a number between 0 and StringLength-1 inclusive, or -1 if it does not find a match?

I thought mid$ returned a true string.

It does. Discostew is describing INSTR, but he got the right idea. Counting is from 0.

You want string to array? It's trivial to modify my @ACT subroutine to do that. Now if you also want to remove duplicates, then it's not so easy. I did manage to get a version that does. But you just want a simple array, right?

Randomous method also works fine. In fact, I think it's better!

I'm glad you like my way! And I'm sorry I also posted a string-parse algorithm, I didn't realize you posted one earlier (I'm so unobservant!). I think they're about equal in terms of time complexity/ease of understanding.

randomous

AuthorMessage
Avatar

PixelRobin

2,609. Posted:

Can you use (variable × 1.4) to convert the current use of timing (60 things in a second) into 100 beats per second? I am making a digital metronome and would like to display speed of ticks in milliseconds.

Everybody do a chirp. CHIRP.

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

3DS Friend Code: 3007-9228-5126

AuthorMessage
Avatar

steriaca

2,610. Posted:

@bluerobin2: Humm...you could try to do a new twist on an old game...like makeing a 'shooter' game like 'Galaxian', but instead of using a fire button, have ball and paddle mechanics like 'Breakout'. Breakaxian? Galaxiout?

My Friend Code is 3368-1310-0690.

AuthorMessage
Avatar

mystman12

2,611. Posted:

I need some help. I have my game programmed like so:

DIM JARRAY(11,11) 'The main character's name is Joe, so anything that starts with J references him. JARRAY is used to locate Joe within the '@PHYMAPDATA DATA

RESTORE @PHYMAPDATA 'Thi s stands for "Physical Map Data", which is the data that controls where you can walk and where you can't

'Some other stuff here (No other data is restored after this point)

'I have all directions of movement programmed, but I will only focus on up

@GAMELOOP
GOSUB @DSPLY 'This updates the display. I'm not including that code here.
GOSUB @JCNTRL
GOTO @GAMELOOP
@JOECNTRL
IF BTRIG()==1 THEN SPANIM 0,4,4,0 'This animates the sprite
IF BUTTON()==1 THEN GOSUB @JOEUP
'Code for other directions
IF BUTTON()==0 THEN SPANIM 0,4,4,1 'Animations stop when nothing is pressed
RETURN

@JOEUP
SPREAD(0),JOEX,JOEY '0 is Joe's sprite number, JOEY is the sprite's X location, and JOEY is the sprite's Y location.
JX=FLOOR(JOEX/16) 'JX is used to locate Joe's X location within the @PHYMAPDATA DATA
JY=FLOOR(JOEY/16) 'JY is used to locate Joe's Y location within the @PHYMAPDATA DATA
READ JARRAY(JX,JY-1) 'This checks the number above Joe's location.
IF JARRAY(JX,JY)==1 THEN RETURN 'If JARRAY = 1, then it returns, without moving Joe
SPOFS 0,JOEX,JOEY-1,1
SPCHR 0,76
RETURN

'Other directions after this point

'Here is the PHYMAPDATA. It may not be exactly the same as I have it now, but it's close enough. 1's represent walls and 0's represent spaces.

@PHYMAPDATA
DATA 1,1,1,1,1,1,1,1,1,1,1
DATA 1,0,0,0,0,0,0,0,0,0,1
DATA 1,0,1,1,1,0,1,1,1,0,1
DATA 1,0,1,0,0,0,0,0,1,0,1
DATA 1,0,1,0,1,0,1,0,1,0,1
DATA 1,0,0,0,1,0,1,0,0,0,1
DATA 1,0,1,0,1,0,1,0,1,0,1
DATA 1,0,1,0,0,0,0,0,1,0,1
DATA 1,0,1,1,1,0,1,1,1,0,1
DATA 1,0,0,0,0,0,0,0,0,0,1
DATA 1,1,1,1,1,1,1,1,1,1,1

Now, here is my problem. When I walk up (or any other direction) eventually I hit a wall, just like I'm supposed to. But, once I hit a wall, I get stuck, and can't move any direction, and, If I keep pressing up, eventually it says I have run out of data to read at the READ JARRAY(JX,JY), even though JX and JY aren't getting any higher. (The display shows me those variables, so I know they're not getting higher.) So, any help is appreciated, and of course, if there is a better method than this, plaese tell me.

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

Xtremetdifan

2,612. Posted:

Hi I have little knowledge of qbasic. Don't worry I'm not asking for help, I just want to say thanks to everybody that has posted qr codes and advice so you know, thanks

Pokemon Mains:Infernape,Stunfisk,Garchomp
Smash Mains:Sonic,Fox,Ike

3DS Friend Code: 4124-5259-4542

AuthorMessage
Avatar

randomous

2,613. Posted:

@Xtremetdifan I haven't really done much in this thread, but I appreciate your appreciation!

@mystman12 I think you've got a little bit of weirdness going on with the logic behind RESTORE and such. Here's how it works:

You put a bunch of data in a DATA section somewhere, like you did in your program. Then you give it a title.

@PHYMAPDATA
DATA 1,1,1,1,1,1,1,1,1,1,1
DATA 1,0,0,0,0,0,0,0,0,0,1
DATA 1,0,1,1,1,0,1,1,1,0,1
DATA 1,0,1,0,0,0,0,0,1,0,1
DATA 1,0,1,0,1,0,1,0,1,0,1
DATA 1,0,0,0,1,0,1,0,0,0,1
DATA 1,0,1,0,1,0,1,0,1,0,1
DATA 1,0,1,0,0,0,0,0,1,0,1
DATA 1,0,1,1,1,0,1,1,1,0,1
DATA 1,0,0,0,0,0,0,0,0,0,1
DATA 1,1,1,1,1,1,1,1,1,1,1

This is exactly what you did for your program, which is right. Now, when you want to read this data, you must first RESTORE it:

RESTORE @PHYMAPDATA

This says "put the READ pointer right at the beginning of the section that starts with @PHYSMAPDATA". That's what you did as well, which is right. Now on to the final part.

READ JARRAY(JX,JY-1)

Almost! What READ does is it says, "I'm looking at the next piece of DATA. I'm going to store it into the variable you gave me". So your command right there will read the first piece of DATA (the upper left most number, which is a 1) and put it into JARRAY at JX, JY-1. What you really want to do is put a whole bunch of READs way up at the top where you did your RESTORE. For instance:

RESTORE @PHYMAPDATA

FOR I=0 TO 10
FOR J=0 TO 10
READ JARRAY(J, I)
NEXT
NEXT

Now what you're saying is "Set the reader to the beginning of the PHYMAPDATA section. Then, read each and every piece of data in the section and store it into JARRAY at the appropriate location. Notice that I used the order (J, I) instead of (I, J). This is because READ goes left to right, so in order to get the same order within JARRAY (where the first index is X and the second is Y), you'll want the inner loop to be your X. In plainer terms, read goes:

READ->READ->READ->READ->READ->READ |
READ->READ->READ->READ->READ->READ |
READ->READ->READ->READ->READ->READ V
through the data

And J within the loop goes: ------------------>
0->1->2->3->4->5->6->7->8->9->10
0->1->2->3->4->5->6->7->8->9->10
0->1->2->3->4->5->6->7->8->9->10

And I goes:
0 |
1 |
2 V

etc

Anyway, now that we've read all the data into JARRAY, we don't need any more READs, so get rid of them. Instead, just do the check in JARRAY like you had:

IF JARRAY(JX,JY-1)==1 THEN RETURN

Since JARRAY already has all the data, you're fine. I did change one thing though: I replaced JY with JY-1 (like you had in the read) because you're looking at the wrong place. Hope that all helps!

Edited on by randomous

randomous

AuthorMessage
Avatar

Discostew

2,614. Posted:

@Gimmemorecoinz

My mistake. I was thinking of INSTR, which was already explained. I was on a 10hr drive, so I wasn't all there.

"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

bigdog00

2,615. Posted:

Just as an update, @hamjam00 and I are making a game called "Lazer Mazer", as well as a few others. It is a game with aspects of a maze, but with lazer guns, hence the name. You have to fight others in a big, mazelike arena. It will support local 6 player on a LAN. I will release a free demo version for you guys if you really want, although the demo won't be avalible until sometime in june (We hope). I like using python and C/++ much better because of the syntax. Thanks!

I like petit computer! Asphault 3d is awesome!

3DS Friend Code: 0473-8697-6288 | Twitter: bigdogdt

AuthorMessage
Avatar

boot

2,616. Posted:

Are you going to give us the fps

Just your average talking boot. The Boot that can program.

AuthorMessage
Avatar

bigdog00

2,617. Posted:

it's not really working, so no.

I like petit computer! Asphault 3d is awesome!

3DS Friend Code: 0473-8697-6288 | Twitter: bigdogdt

AuthorMessage
Avatar

boot

2,618. Posted:

You could let us try it...please?

Just your average talking boot. The Boot that can program.

AuthorMessage
Avatar

bigdog00

2,619. Posted:

You do practically nothing... you sit there, wait for a paratrooper to fall, and you shoot him down. If you really want it, someone can improve on it, but someone else will have to do the qr codes. I will upload it later this summer.

I like petit computer! Asphault 3d is awesome!

3DS Friend Code: 0473-8697-6288 | Twitter: bigdogdt

AuthorMessage
Avatar

MrSirr

2,620. Posted:

I need help with making a highscore system, how do you make it to where your score is at zero, and keeps going up? I tried and ended up with it going like this instead:
1
2
3
4
lol so REALLY confused. help please.

MrSirr