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.
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!
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.
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.
@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?
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.
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
Botw > OoT
3DS Friend Code: 0748-4970-2550 | Nintendo Network ID: Xjarnold
@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:
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:
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!
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!
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 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 @START
SCORE=0 @LOOP
LOCATE 0,0RINT (SCORE) 'this will print it in the same location every time
SCORE = SCORE+1 'adds 1 to score
VSYNC 60 'vsync is like wait
'--other code stuffs--
IF --insert gameover stuff here-- THEN GOTO @DIE
GOTO @LOOP @DIE
SAVESCORE=SCORE
SCORE=0
GOTO @START
saving is another part. If you want, I can help with that as well...
@Mrsirr @START
SCORE=0 @LOOP
LOCATE 0,0RINT (SCORE) 'this will print it in the same location every time
SCORE = SCORE+1 'adds 1 to score
VSYNC 60 'vsync is like wait
'--other code stuffs--
IF --insert gameover stuff here-- THEN GOTO @DIE
GOTO @LOOP @DIE
SAVESCORE=SCORE
SCORE=0
GOTO @START
saving is another part. If you want, I can help with that as well...
OF COURSE locate command! didnt think of that! Thx man!
Forums
Topic: Petit Computer
Posts 2,601 to 2,620 of 9,620
Please login or sign up to reply to this topic