Forums

Topic: Petit Computer

Posts 6,541 to 6,560 of 9,620

randomous

@calc84maniac Ahh, so SPHITNO returns the sprite with the lowest ID that is currently colliding with ours... Thank you very much!

randomous

damolii

TAINT_Zzyex wrote:

http://petitcomputer.wikia.com/wiki/RPG_Sprites FINAL edition of my rpg sprites. more will come i guess. these are all that i will have in my first game. (ize got movement in) when i have a battle system i will post

You could just try and use mine.......

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

InsertPi

I'm working on some techniques for render distance. I'm getting some the somewhat work. I thought I had hit the gold when it didn't show any blocks after 16 blocks, but after playing around with it a bit, it was the glitchiest thing I've ever made, and that's an understatement. Have you ever seen boogie blocks? That was what I had going on. It was a dance fest with the blocks!

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

randomous wrote:

The solution I came up with was to use a string to represent which slots were currently open and which were not. It would start out as a string filled with 0's or something. I could then use INSTR to get the first occurrence of a 0, and that position would be the first free position in the array of velocities/etc. I'd then set it to 1. This sort of solves the "linear search" problem, as I've replaced an interpreted linear search with a "native" one.

I know there's a better way to this... but I just can't think of it. Do you guys have any suggestions?

I don't see a better way than that. You can fake linked list with array. You can compress the list while scanning. But for searching list with lots of item manipulations, hashing is the best solution, and for as long as you can search quickly with string, just do it with string. That's what I'd do with C language, anyway. If I were you, I'd probably do the compression thing during idle loop. It's just so easy and simple that way. Assuming the item coming and going isn't so heavy, you probably can get away with just scanning/compressing a few items at a time. It won't be worse than present situation, in any case.

I see calc84maniac has a simple good solution. It does mess up the order. I take it, ordering doesn't matter then? Then I must be misunderstanding your problem. Are you keeping the list for processing "active sprites"? If so, you may want to delete several items at once. If that situation occurs often, then idle compressing would work better. Just set it up as background process during idle loop, so you don't have to worry about it in the main.

calc84maniac wrote:

randomous wrote:

Hey, what happens to SPHITNO when the our sprite hits multiple sprites? Is there a way to get each sprite that our sprite is colliding with?

Yeah, SPHIT takes an optional second argument which is the initial ID of the other sprites to check collision with. So to detect multiple collisions, put SPHITNO+1 in that second argument to search after the first detected collision.

I use SPCOL to separate collisions. But that second argument is useful than just first detecting collision. When you group a certain sprites, say enemies at sprite 50-80, then you can simply do SPHIT(player,50) to check enemy collision directly. You still need to check for range, so if the sprite control number is greater than 80, then you're colliding with something else.

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

randomous

@ramstrong If I'm using the data that the sprite can hold, then the order wouldn't matter, because I just need to go through the sprites and update positions and such.

randomous

ramstrong

randomous wrote:

@ramstrong If I'm using the data that the sprite can hold, then the order wouldn't matter, because I just need to go through the sprites and update positions and such.

It depends on how you structure your program. I like to keep the ordering because it helps with groupings, or hierarchical processing.

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

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

GraphicGenius

Sorry I haven't been on the forums lately @Pootrick2 I blame Minecraft (Not saying it's a bad game!) taking up all my time.
Anyways, What should I work on? And @IAmAPerson

HOW DO YOU DO GRAPHICS?!?!

I really need to know the answers to both of these questions to work on the game.

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

InsertPi

programmerpro wrote:

IAmAPerson HOW DO YOU DO GRAPHICS?!?!

Not too hard. First, we have to set up our screen so that we can draw.

ACLS:CLEAR

This you should already know. If not, ACLS clears ALL the screens of EVERYTHING (except sprites. for that, do SPCLR) and CLEAR clears all the variables

GPAGE 0

This says to draw on the top screen. 1 is bottom screen. 2 and 3 are invisible; those might not seem important, but it's essential to stuff like Minecraft DS

GCOLOR 15

Sets the drawing colour to white. 0 is transparent. Different numbers make different colours.
Now we're ready to draw. (NOTE: The [ ] means that it is not a required field)

GPSET X coord,Y coord[,colour]

Makes a dot at a specific point on the screen

GLINE X start,Y start,X end,Y end[,colour]

Makes a line on the screen

GBOX Top-left X,Top-left Y,Bottom-right X,Bottom-right Y[,colour]

Makes a box on the screen

GCIRCLE X coord,Y coord,radius[,colour]

Makes a circle on the screen

GCLS

Clears JUST the graphics

GFILL Top-left X,Top-left Y,Bottom-right X,Bottom-right Y[,colour]

Makes a section of the screen a specific colour

These are the basics! If you wish for some more, just ask!

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:

randomous

@Discostew Thanks! @calc84maniac already explained it, but at least now I've got two people backing the same method lol.

It would be nice if the sprite hitbox would follow the angle of SPANGLE. The shots are lines, and I had wanted to make the hitbox a line... but it keeps its orientation when using SPANGLE. Oh well.

randomous

Slayer

randomous wrote:

@Discostew Thanks! @calc84maniac already explained it, but at least now I've got two people backing the same method lol.

It would be nice if the sprite hitbox would follow the angle of SPANGLE. The shots are lines, and I had wanted to make the hitbox a line... but it keeps its orientation when using SPANGLE. Oh well.

Oh, say does that star-SPANGLEd banner yet wave
O'er the land of the free and the home of the brave?

I have nothing really to say about myself.

GraphicGenius

IAmAPerson wrote:

If you wish for more, just ask!

I would like to know more, like how you can do stuff like drawing.

Bluerobin2 wrote:

you should really check out ramstrong's blog

He's right. I made a really complicated game in less than 9 posts!

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

Discostew

randomous wrote:

@Discostew Thanks! @calc84maniac already explained it, but at least now I've got two people backing the same method lol.

It would be nice if the sprite hitbox would follow the angle of SPANGLE. The shots are lines, and I had wanted to make the hitbox a line... but it keeps its orientation when using SPANGLE. Oh well.

What about making a small collision box on one end of the line, and then using SPCOLVEC to extend that box over to the opposite end of the line? The manual says +-16 for both X/Y, but you could check if it'll go beyond that.

Discostew

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

randomous

@Discostew Of course, the voice of reason lol. Thank you, I'll try it. Oh, but if it's a line that's angled, I'd need to set the collision box to the right place on one of the edges, wouldn't I?

randomous

Pixelrobin

You know what guys, screw the wiki entry for now. The deadline is too close. I'm going back to Small_Math. Once I complete it, I will port it to graphing calculators (CASIO color ones first since I have one). I'm also editing my blog, which has some embarrassing typos in it. I will try to post daily on it, as well as progress on PTC Community since mist of it is hidden. BTW, you guys should really check out ramstrong's Blog. It has really good Petit Computer posts.

Everybody do a chirp. CHIRP.

3DS Friend Code: 3007-9228-5126

InsertPi

programmerpro wrote:

IAmAPerson wrote:

If you wish for more, just ask!

I would like to know more, like how you can do stuff like drawing.

You simply do GPAGE 1, take the TCHX and TCHY system variables, and use those for where you draw! For example:

ACLS:CLEAR:GPAGE 1:GCOLOR 15
PRINT "Touch a place on the screen, and a dot will appear there!"
@LOOP
IF TCHST==1 THEN GPSET TCHX,TCHY
VSYNC 1
GOTO @LOOP

Also, what else would you like to know? You said more, not just drawing.

@Bluerobin2 YAY! I've been waiting for SmallMath! (If I count it as a full coding language, it'll be the 6th programming language I will have learned)

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:

GraphicGenius

IAmAPerson wrote:

programmerpro wrote:

IAmAPerson wrote:

If you wish for more, just ask!

I would like to know more, like how you can do stuff like drawing.

You simply do GPAGE 1, take the TCHX and TCHY system variables, and use those for where you draw! For example:

ACLS:CLEAR:GPAGE 1:GCOLOR 15
PRINT "Touch a place on the screen, and a dot will appear there!"
@LOOP
IF TCHST==1 THEN GPSET TCHX,TCHY
VSYNC 1
GOTO @LOOP

Also, what else would you like to know? You said more, not just drawing.

I actually meant GRPED. Like how do you use it and put it in your program?

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

Discostew

randomous wrote:

@Discostew Of course, the voice of reason lol. Thank you, I'll try it. Oh, but if it's a line that's angled, I'd need to set the collision box to the right place on one of the edges, wouldn't I?

I was thinking, if you use SPHOME to put one end of the line on where the "origin" of the sprite is, you won't have to change SPCOL everytime for different angles. It's always be on one end, and you can use SPCOLVEC to extend from that box. Using SPHOME like this would also allow you to rotate the line too in the direction you want it to be, with the back-end on the sprite origin.

Discostew

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

GraphicGenius

I can do anything for anyone! Except for now. The Million Second Quiz is coming on.

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

ramstrong

Discostew wrote:

randomous wrote:

Hey, what happens to SPHITNO when the our sprite hits multiple sprites? Is there a way to get each sprite that our sprite is colliding with?

Someone had asked about sprite collision some pages back, and I explained it, including code for handling collision of multiple sprites with one.

https://www.nintendolife.com/forums/dsiware/petit_computer?sta...

That post not in Tutorial thread, no way people are going to find it. How about reposting it to Tutorial thread?

@bluerobin2
Thanks for the endorsement. The link in my signature is specific to Petit Computer Tutorial, so you don't have to deal with Raspberry Pi or cooking posts. I still need to update the QR codes, though. They're on the old blogspot site at ramstrong, if you're looking for them.

@programmerpro
I did a Paint program blogpost when I was learning graphics. I suggest you check it out! It's the paint program I used to draw the Goldfish for Coral Maze, FYI.

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