Forums

Topic: Petit Computer

Posts 7,921 to 7,940 of 9,620

Discostew

cigsthecat wrote:

Aha! That makes sense, thank you. I suppose using CLEAR every time right before DIM is the way to go.

CLEAR does as it says, clears the memory, which means all variables and arrays will be erased/reset. I usually put it near the start of my program so I know I'm starting with fresh memory to work with.

Discostew

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

InsertPi

Minecraft DS Beta 1.8!!!
NOTE: Your old worlds will not work, and the changes are too complex for a conversion.

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:

ramstrong

cigsthecat wrote:

Aha! That makes sense, thank you. I suppose using CLEAR every time right before DIM is the way to go.

Well, I guess now you know why I did CLS:CLEAR on my program. Those two do different things.

Edited on by theblackdragon

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

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

Lego-Meister

@bro12 I can't get all qr codes. I recommend using Petit Computer QR Stitcher and making a PTC Wiki page.

Some programmers pride themselves on how many more lines of code they can write. I pride myself on how many less.

3DS Friend Code: 3652-1447-0455 | Nintendo Network ID: Legos-Meister

theblackdragon

Guys (and this goes to everyone, mind you) — I do understand how frustrating it can be to have a user ask a question you've already answered someplace, but please, if you don't have it in you to direct a user to where they can find their answer in a civil manner, just let it lie and allow someone else to do it for you. (@ramstrong, you'll notice I've edited the reply that sparked this whole mess into something much less offensive. Please keep it in mind the next time you're tempted to bite someone's head off.)

As for the argument itself (this goes to @0Games at the moment, but again, it does apply to all of you), if ever any of you feel you've been personally attacked by another user for whatever reason, please use the Report button (located handily above every post made on our forums, it's an onmouseover thing if you don't see them right off the bat) to notify the moderation team and don't bother with any knock-down drag-out fights in-thread — it just gives us a bigger mess to wade through. We'll be happy to figure out what's going on and get everyone squared away so that the thread may continue on as smoothly as possible.

Thanks in advance, guys!

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!!!

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

Slayer

theblackdragon wrote:

If ever any of you feel you've been personally attacked by another user for whatever reason, please use the Report button Thanks in advance, guys!

TOTALLY forgot about that thing. Thank you, theblackdragon.
Now, I'm going to attend to a health system that will work good. @Hansausage, if you mind, could you post what you have on Apocalypse Rising? Finish whatever you have in progress on it first, though- it would really help because you said you finished the zombies if my memory doesn't fail me, and I need those for a solid health system.

Edited on by Slayer

I have nothing really to say about myself.

twinArmageddons

tbd is here to save the day again

get in loser we're going titan hunting

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

TAINT_Zzyex

Thank you TBD! Now, has anyone tried the new btc update?
If so/If not
how can i fix the shop?
I haz:
cls
if coin=100 then hp=100 else print "not enough coin
if coin=100-100
wait 120
goto @shop
It goes to else even with 100 coins AND it minuses money without healing.

"Did somebody say Aincrad?"
"No, go back to your own game!"
"awwww"
"And make out with Asuna."
"Aww-I mean YAY"

Twitter:

LeviCelJir

Yay The fight is gone

Anyway I don't know why @IAmAPerson but you seem like you are trying to get rid of my 1.5 map (Joking) But you will never defeat LeviLand! Yes Everyone's favorite 1.5 map is up and running 1.8! Hehehe Person... thinking 1.8 will be the end of my Favorite World...

Anyway I found a mega game-breaking bug in 1.8... some blocks like wood planks, stone, and TNT are unbreakable. Its kinda annoying. I thought building with bedrock is hard but now... WITH WOOD??? Its so sad...

Lastly Person I was wrong. The terrain generator can make some cool worlds! Even with just the grass circles.

Hi I'm Levi and I like Bloopys :^)

InsertPi

@Leviceljir can you give more details on the bug? I'm not having any problems with it. It may be a problem with the map conversion.

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:

LeviCelJir

@IAmAPerson
I thought it might be a map coversion bug too but I tried it in a fresh world and it still wasn't working... I don't know what its doing it for... I'll go try some stuff and tell you my results.

Hi I'm Levi and I like Bloopys :^)

LeviCelJir

@IAmAPerson
Ohhh after a experiment or two I found out the problem. Certain blocks won't break using the "break block" button on the bottom screen but will work with L button. Which is a mega problem for me because my L button has trouble working...

Hi I'm Levi and I like Bloopys :^)

InsertPi

@LeviCelJir ahhhhhhhhh I know what's going on. I done goofed when I was changing that 400 lines of code. I'll release a Beta 1.8.1 bug fix that fixes a few other bugs in a couple days. I can tell you how to fix it yourself though. On lines 458 and 459. Change

IF BSTAT AND TDS AND MAP(I,J)AND...
IF BSTAT AND !TDS AND MAP(I,J)AND...

to

IF BSTAT AND TDS AND MAP(I,J)>0AND...
IF BSTAT AND !TDS AND MAP(I,J)>0AND...

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:

LeviCelJir

@IAmAPerson
Yay! I can play my 1.5 map in 1.8 without bedrock wood! and bedrock TNT.

By the way... I can tell I'm gonna be a great 2.0 tester :3 I found an annoying bug on the first day!

P.S. Converting my map was easy. You made it out like it was the hardest thing in the world. You were like "Oh yeah Levi Converting maps isn't easy anymore. It will be hard. I recommend just giving up your world. Well... Have fun!"

...It...Was...So...Easy...

Edited on by LeviCelJir

Hi I'm Levi and I like Bloopys :^)

ramstrong

Thanks TBD. Sorry for the trouble. I don't suppose you can make the Tutorial thread "sticky", do you? It would be helpful, so we don't have to point to it every so often.

TexMurphy wrote:

@ramstrong
I typed in both of your walking programs. In your character walking tutorial, change SPCHAR to SPCHR under @ANIM. Can you write a tutorial where the character stops moving when the Dpad is released? Thanks
What we need are templates for platform games, rpgs, fighting games, and side scrollers.

You know, you don't have to ask me about it. Lots of other qualified people can answer that question for you. If you look at the latest Tutorial entry, you'll see an extra mode for "STOP". So, you'll need to add that in if you want to stop.

Actually, that's a simplification of the process. A more sophisticated version would be to determine the walking speed. So, stopping is simply zero speed. An easy way to do it would be to reset the speed every time you ask for direction.

B=BUTTON(0)
SPEED=0:'INSERT THIS HERE
IF B AND 1 THEN D$="U":SPEED=20
IF B AND 2 THEN D$="D":SPEED=20
IF B AND 4 THEN D$="L":SPEED=20
IF B AND 8 THEN D$="R":SPEED=20

And on @ANIM, you want to set the speed accordingly. Something like this:

@ANIM
SPCHR 2,A
SPANIM 2,4,SPEED/4
SPOFS 2,SX*16,SY*16,SPEED

You need to be careful and go through the program logic, and make sure SX,SY are unchanged when the speed is zero, but I'm sure you'll be able to do that no problem. Once you've done that, you may want to adjust SX,SY values according to SPEED variable. Right now it's based on 16x16 grid. You can change that to SX*SPEED*RATIO, instead. (This is just an example, you don't type that in exactly and expect it to work.)

Another way to look at it would be a simplification of the whole process. Think of turn based game. Do you want to go UP, DOWN, LEFT, RIGHT, SHOOT, or do STOP? And simply build a table to reflect that. That's what I did on my last entry, and it's so easy, I built the whole program all at once.

Currently, the program assumes that if you don't give any input, you want to keep going where you're going. In other words, the last directional command. However, it can be changed so that the default would be, if you don't give any input, the default command would be STOP.

HTH.

Speaking of templates, I'll be doing a few sprite games templates (similar to WITCH, but encompassing more game types). Then I'll be doing something like a dungeon level editor (256x192 in size). So, that's something to look for ... in the (very far) future.

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

cigsthecat

Discostew wrote:

cigsthecat wrote:

Aha! That makes sense, thank you. I suppose using CLEAR every time right before DIM is the way to go.

CLEAR does as it says, clears the memory, which means all variables and arrays will be erased/reset. I usually put it near the start of my program so I know I'm starting with fresh memory to work with.

OK, gotcha.

ramstrong wrote:

cigsthecat wrote:

Aha! That makes sense, thank you. I suppose using CLEAR every time right before DIM is the way to go.

Well, I guess now you know why I did CLS:CLEAR on my program. Those two do different things.

Yep! I realized that.

I was looking at this Morpheel tut, and I have some questions.

Morpheel wrote:

Eh let's see...
You have
@MAP1
DATA "111111"
DATA "100001"
DATA "102201"
DATA "102201"
DATA "100001"
DATA "111111"

And you want to use that data to draw a 6*6 room using some background tiles.

LABEL$="@MAP1" 'set the label where the DATA is

As I understand it, LABEL$ is a custom string variable, yes? So it doesn't need to be LABEL$, it could be any text ending with $?

@DROOM 'a subroutine to draw a 6*6 room using DATA
RESTORE LABEL$ 'set the DATA pointer to that label

Could someone explain a bit about the RESTORE function? I have a basic understanding of GOTO and GOSUB-RETURN. How is it different from those?

Also why is it necessary to set LABEL$="@MAP1"? Couldn't you simply do RESTORE @MAP1?

FOR Y=0 to 5 'start Y for
READ L$ 'read a line of DATA

I see L$ here (short for LABEL$?). Why does this work?

FOR X=0 to 5 'start X for

Why don't we need another "READ L$" here for X?

IF MID$(L$,X,1)=="0" THEN BGPUT 0,X,Y,45,8,0,0 'draw background tile 45 if the Xth data of the Yth DATA line is 0
IF MID$(L$,X,1)=="1" THEN BGPUT 0,X,Y,54,8,0,0 'draw background tile 54 if the Xth data of the Yth DATA line is 1
IF MID$(L$,X,1)=="2" THEN BGPUT 0,X,Y,65,8,0,0 'draw background tile 65 if the Xth data of the Yth DATA line is 2

So if we imagine the 6x6 DATA square as 6 columns- is this function reading the numbers from the top to the bottom of column one, then doing the same for the others moving left to right?

NEXT X:NEXT Y 'Move on
RETURN 'Return

Here he's using a RETURN without a GOSUB. Is this just here out of habit since you'd expect to arrive at all of this code via a GOSUB as part of a larger program?

Sorry if these questions are super basic (haha), but I really like how this works and want to understand it better.

here's Morpheel's code without my interruptions:

Morpheel wrote:

Eh let's see...
You have
@MAP1
DATA "111111"
DATA "100001"
DATA "102201"
DATA "102201"
DATA "100001"
DATA "111111"

And you want to use that data to draw a 6*6 room using some background tiles.

LABEL$="@MAP1" 'set the label where the DATA is

@DROOM 'a subroutine to draw a 6*6 room using DATA
RESTORE LABEL$ 'set the DATA pointer to that label
FOR Y=0 to 5 'start Y for
READ L$ 'read a line of DATA
FOR X=0 to 5 'start X for
IF MID$(L$,X,1)=="0" THEN BGPUT 0,X,Y,45,8,0,0 'draw background tile 45 if the Xth data of the Yth DATA line is 0
IF MID$(L$,X,1)=="1" THEN BGPUT 0,X,Y,54,8,0,0 'draw background tile 54 if the Xth data of the Yth DATA line is 1
IF MID$(L$,X,1)=="2" THEN BGPUT 0,X,Y,65,8,0,0 'draw background tile 65 if the Xth data of the Yth DATA line is 2
NEXT X:NEXT Y 'Move on
RETURN 'Return

That way you can write yourself multiple DATA structures with number variations to draw different rooms using the same code.
Or something like that.

Edited on by cigsthecat

cigsthecat

ramstrong

cigsthecat wrote:

As I understand it, LABEL$ is a custom string variable, yes? So it doesn't need to be LABEL$, it could be any text ending with $?
Also why is it necessary to set LABEL$="@MAP1"? Couldn't you simply do RESTORE @MAP1?

Yes, LABEL$ is simply a string variable, and you can use anything you want. You can also do RESTORE @MAP1 directly if you want, but using string is more flexible.

RESTORE isn't like GOTO/GOSUB in that the program execution does not go there. It simply tells the program, whenever you see a READ command, this is the data you want to read. RESTORE is used to select different parts of DATA section. Say you have DATA for sprites, and background data. You can write
@SPRITE
DATA ...

@BGDATA
DATA ...

And use RESTORE @SPRITE or @BGDATA to select which DATA you want to load, either sprite data or background. However, program execution does not go there. It's simply used to set which data you want to read. Think of it like a file-selector switch, instead of GOTO/GOSUB

I see L$ here (short for LABEL$?). Why does this work?

No. L$ is a normal variable, not short for LABEL$. L$ is the variable containing the data "111111", "100001", "102201" and so on. Think of READ as a substitute for INPUT. Whenever you want non-interactive INPUT, you use READ (which reads the input on DATA)

Why don't we need another "READ L$" here for X?

Because X is used to go through the characters in L$ using MID$ command. Think of it as FOR X=0 to LEN(L$)

IF MID$(L$,X,1)=="0" THEN BGPUT 0,X,Y,45,8,0,0 'draw background tile 45 if the Xth data of the Yth DATA line is 0
IF MID$(L$,X,1)=="1" THEN BGPUT 0,X,Y,54,8,0,0 'draw background tile 54 if the Xth data of the Yth DATA line is 1
IF MID$(L$,X,1)=="2" THEN BGPUT 0,X,Y,65,8,0,0 'draw background tile 65 if the Xth data of the Yth DATA line is 2

That's just a translation table. 0=45. 1=54. 2=65.

Here he's using a RETURN without a GOSUB. Is this just here out of habit since you'd expect to arrive at all of this code via a GOSUB as part of a larger program?

Part of a larger program. You see him using the word "subroutine". You use GOSUB @DROOM.

Sorry if these questions are super basic (haha), but I really like how this works and want to understand it better.

Those are good questions, so I don't mind. Of course, there's more than one way to learn. There's more than one post regarding DATA. So, it's a good idea to read all the tutorials to get an overview of things.

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

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

ramstrong

I updated October Petit Computer Journal. Finally. Randomous' Solitaire Depackaged is mentioned there, FYI. November is also up. I'll be working with Virtual Keyboard for November. Between main loop and user interface, I should be able to handle quite a lot of things with ease.

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

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

Please login or sign up to reply to this topic