Forums

Topic: Petit Computer

Posts 261 to 280 of 9,620

Eel

Ooohhh it even tells you your hit rate!
Congratulations, I think you're the first person to complete a game project in this thread.
You should post it on the QR sharing thread.

I'll post new pictures of my project later today.

Edit:
Since my 3DS's touchcreen's screen protector is pretty foggy from all the tapping and drawing I'll just put some of the sprites I have made for the game here... You're free to reproduce and use them on your own projects if you wish to.
Untitled

(note: The first three characters are actually just shopkeepers and the fourth one is the player, the last shoopkeeper and the player are based on the premade witch and knight sprites)

Edited on by Eel

Bloop.

<My slightly less dead youtube channel>

SMM2 Maker ID: 69R-F81-NLG

My Nintendo: Abgarok | Nintendo Network ID: Abgarok

neoxid500

Soo I was hoping I could get some assistance with spawning sprites and how to use the collision detection commands. So a link would be nice an some answers to these questions too please =), ty!
Is it possible to have more than one of the same sprite on screen with the same value?
Can an object in the background be treated with a value, as in a wall to stop sprite bullets?
Can you make the game spawn in a pre-made map but only display part of it on the screen (a bit like an on rails shooter, except heading more toward the top of the screen will cause it to scroll)?
Again, thanks!

neoxid500

neoxid500

Peidorrento wrote:

So there it is. The "retail version" of my invaders port. It is very simple but I think it is better to start simple.
There are 2 dificulty levels which will give different points count. It saves your Highscore.
The graphics are the same as before.
The code:
http://img402.imageshack.us/img402/7163/invaders9.png
Enjoy and please give me some feedback!

[/div]

A very big problem that's evident in this is I can't load your sprite file because I don't have it =P
Other than the sprites looking ugly because it uses the preset sprites it plays very well, although I would like to know what language the text is in... is it spanish?

UPDATE: mmk, found your post with the graphics, looks much better =3 now the only problem is the language XD

Edited on by neoxid500

neoxid500

Eel

@zezhyrule: @Retro_on_theGo: Thanks , though to be honest, the cow is totally modeled after Harvest Moon (SNES) cows

@Retro_on_theGo: You don't really need to "get the most out of it" to have fun with this, just fiddling around with the code to see what happens is very entertraining (and educative I suppose). Other than needing to learn some commands and their parameters, programming is just a bunch of basic logic slapped together.
I'm sure anyone could make at least something with it. It doesn't really need to be a game or look like an iOS app.

@neoxid500: That's actually Portuguese, I talk Spanish so I can grasp most of it. I guess English-talkers may have a harder time reading it.

neoxid500 wrote:

Soo I was hoping I could get some assistance with spawning sprites and how to use the collision detection commands. So a link would be nice an some answers to these questions too please =), ty!
Is it possible to have more than one of the same sprite on screen with the same value?
Can an object in the background be treated with a value, as in a wall to stop sprite bullets?
Can you make the game spawn in a pre-made map but only display part of it on the screen (a bit like an on rails shooter, except heading more toward the top of the screen will cause it to scroll)?
Again, thanks!

Well you see, these one of the few things that are actually explained quite nicely on the manual, but I'll try to explain the logic behind sprites.

You can set up to about 100 sprites at the same time on the screen, though you could see them more as "objects" than sprites.
To "initiate" a Sprite (or object) you use SPSET (look the manual for the parameters), the one thing you need to remember is the "Control Number" you give to that sprite (which can be any number from 0 to 99 I think), using that control number you can then use other comands like SPOFS (which allows you to move the sprite around), SPSCALE, SPANGLE, etc.
The same control number is used with the colition detection commands (which are also explained in the manual), so you can check if the sprite 0 is colliding with the sprite 1 or any other sprite and tell the game what to do.
You can reinitialize sprites as much as you want so you can reuse Control Numbers, just remember, only 100 at a time on the screen

I'd recommend you to get a notebook and write all the SP-related commands.

This language is very old school so you won't find any easy solution to make "walls" from the background, you could use invisible sprites or something completely different, you need to think of various ways to solve that, just look at it from different angles until you find the solution that best suits your project, then you'll even be able to reuse that solution in other games!

Backgrounds are limited to 512*512 pixels (that's a little more than 4 full DS screens) and you can scroll through these pixels with easy to use commands, just keep in mind this: Even if you scroll through the background, sprites will stay in the same position until you move them by code, and.... If you want bigger enviroments, you'll need to find a way to update the background by code.

It may sound a little overwhelming, but it is not as hard as it seems... Playing some old games or reading about how they work will help you.
For example: Metroid has actually a set number of pre-made rooms or "room styles" that repeat themselves around the game world with different palletes to create the different areas of planet Zebes (several other NES games work in the same way), by using the DATA and READ commands, that would be actually quite easy to do!

Edited on by Eel

Bloop.

<My slightly less dead youtube channel>

SMM2 Maker ID: 69R-F81-NLG

My Nintendo: Abgarok | Nintendo Network ID: Abgarok

Peidorrento

@neoxid500
As it is a very simple game with few options and no items at all, I thought that the language wouldn't be a problem. I needed this particular game to be in Portuguese, as I have been playing english games since I was a kid. REVENGE!!! I will make all the other projects with two language settings though.

If you want me to translate it and make a little "walkthrough" through the code, please let me know.

"A vingança nunca é plena, mata a alma e a envenena" - Seu Madruga
Presidente, CEO, Programador e único empregado da Peidosoft.
https://www.facebook.com/nonamefornowsoft

neoxid500

@morphtroid
Oh okay very helpful =)
The wall situation, I've just made sprites for them and I'll just have to have them spawn in a preset fasion.
For the map, well that goes with walls. It might actually be beneficial (in terms of this being my first project XD) to just have everything on the one screen and have everything spawn in that area (but I'll still have to make sure not to have more than 100 sprites). Sprite movements... well I'll take a look at how @Peidorrento made his ship move in his game first, to get an idea of it, but then I don't think I'll get how to make something move in the other 6 directions.

@Peidorrento lol, it's fine. But thanks for posting your code, I actually learned how to spawn sprites from your game and hopefully figure out how to make a character move in the 8 compass directions =)

neoxid500

Peidorrento

@neoxid500
Great! I hope you realise how to do it. Here is a hint: up = 1, down = 2, left = 4, right = 8. The diagonals are combinations of up+left (=5), up + right (=9) etc...
Looking forward to see what you can do.

"A vingança nunca é plena, mata a alma e a envenena" - Seu Madruga
Presidente, CEO, Programador e único empregado da Peidosoft.
https://www.facebook.com/nonamefornowsoft

neoxid500

@Peridorrento lol, I got how to get the command to work, it's just making the sprite move in that direction that I think I have an idea for, but I wanna know if I have the commands understood...
SPREAD can obtain the current coordinates of a sprite
SPOFS moves a sprite to a locations over a certain period of frames
I can assign variables for the coordinates.
If that's all true, than I can have the program obtain the current location of the sprite (SPREAD), have the coordinates be added or subtracted (depending on the direction) based on which buttons are pressed and for how long, then make the sprite move in that direction (SPOFS) all running on variables. Do I have that right? Hopefully, because that sounds like it makes sense, but I don't know if I have the commands right XP, I'll try it...

Update: "Out of Memory (70, GOSUB)" So, I'm trying to make it so the game can recognize the character input movement and the game spawning everything else at the same time. Is that too much or something or is it because I have 9 BTRIG commands after @PLAYERCONTROLS

Edited on by neoxid500

neoxid500

Peidorrento

@neoxid500
I didn't use the "SPREAD" command, only SPSET and SPOFS. Taking the "SPREAD" part, it seems that the logic is alright ("than I can have the program obtain the current location of the sprite (SPREAD), have the coordinates be added or subtracted (depending on the direction) based on which buttons are pressed and for how long, then make the sprite move in that direction (SPOFS) all running on variables.")
About the "Out of Memory" issue. No clue here.

"A vingança nunca é plena, mata a alma e a envenena" - Seu Madruga
Presidente, CEO, Programador e único empregado da Peidosoft.
https://www.facebook.com/nonamefornowsoft

neoxid500

Okay, so I have a code setup for the movement of my character. However, whenever I press whichever button to have my character move, he'll clip to the top left of the screen, and although the correct animation will play he won't move (so basically I've gotten about 50% of the way there =P). So below is the code that I'm using to create the character's movement (just up, down, left, and right for now), help please? =)

@PLYRCONTROLS
WAIT 1
SPREAD(0), X, Y
@MOVEBTTNS
IF BTRIG()==1 THEN GOTO @MOVEUP
IF BTRIG()==2 THEN GOTO @MOVEDOWN
IF BTRIG()==4 THEN GOTO @MOVELEFT
IF BTRIG()==8 THEN GOTO @MOVERIGHT
GOTO @MOVEBTTNS

@MOVEUP
SPOFS 0, X, Y - 16, 30
SPSET 0, 140, 0, 0, 0, 0
SPANIM 0, 4, 20, 0
GOTO @PLYRCONTROLS
@MOVEDOWN
SPOFS 0, X, Y + 16, 30
SPSET 0, 132, 0, 0, 0, 0
SPANIM 0, 4, 20, 0
GOTO @PLYRCONTROLS
@MOVELEFT
SPOFS 0, X +16, Y , 30
SPSET 0, 136, 0, 0, 0, 0
SPANIM 0, 4, 20, 0
GOTO @PLYRCONTROLS
@MOVERIGHT
SPOFS 0, X -16, Y , 30
SPSET 0, 128, 0, 0, 0, 0
SPANIM 0, 4, 20, 0
GOTO @PLYRCONTROLS

So that's what is currently written in the code, and as a point of reference, the sprites current coordinates are (120, 160). And so that where I screwed up can be explained to me better, here's my understanding:
SPREAD retrieves a sprites coordinates, angle, etc. So, I set the x-value of the sprites coordinate to X and y-value to Y (these variables will probably be changed later). Therefore, if I want my character to move up, I have to change the animation to the "up" animation (which is completed). and then make my character physically move up (no completed). So do have it actually move, I add to the Y value in the SPOFS command to make the sprite move, change the animation, then have the program reload the coordinates with SPREAD to have X = X and Y = Y+16. However, no movement is made, and the character again just clips to the top left. Help is appreciated, thanks!

neoxid500

RATJUICE

Morphtroid wrote:

@DrKarl: Well, right now my workaround to this problem is using background character tiles for everything I need on the touch screen:
Untitled

Haha my code is already a 600 lines long mess and I'm sure I'm far from finishing my Petit Farm.

Extra Image

Oh, and I noticed we still have the "TALK" comands, anyone knows if they work in our version?

That looks cool! Will you share qr code?

RATJUICE

Peidorrento

@neoxid500
I might be wrong but I´m pretty sure that, by puttin "SPSET XXXXX" after "SPOFS" you end up reseting your sprite. That would explain why it keeps going to 0x0 position. Take the SPSET part off and try.

"A vingança nunca é plena, mata a alma e a envenena" - Seu Madruga
Presidente, CEO, Programador e único empregado da Peidosoft.
https://www.facebook.com/nonamefornowsoft

KAHN

can someone please explain to me how GOSUB works? what is a subroutine? explain in detail, please!
edit: also, i don't know what a control number is that would be nice to know.

Edited on by KAHN

KAHN

3DS Friend Code: 1032-1301-2772 | Nintendo Network ID: Milkman12

DrKarl

0LD_SK0OL_PUNK wrote:

can someone please explain to me how GOSUB works? what is a subroutine? explain in detail, please!

See my post here: https://www.nintendolife.com/forums/dsiware/petit_computer?sta...

A subroutine is a section of code that you intend to reuse over and over. Instead of writing the same code in many different places throughout your program, you can instead write that code only once, and then use GOSUB to fire off that section of code.

All subroutines begin with an @ label, and end with the command RETURN. The RETURN is used to bring the execution of the code right back to where the GOSUB was called.

See my example earlier in this thread and let me know if you still have questions.

Edited on by DrKarl

DrKarl

KAHN

@DrKarl
thanks a lot! GOSUB makes a lot more sense to me now! just one more question, unless more arise from the next answer: what is a control number? I've looked through the manual for words i can use, and found PLENTY, most of which i understand perfectly, but "control number" keeps showing up in the FORMAT, and i keep on googling it, but i keep on finding junk instead of something i can use what's a control number?

KAHN

3DS Friend Code: 1032-1301-2772 | Nintendo Network ID: Milkman12

DrKarl

0LD_SK0OL_PUNK wrote:

i don't know what a control number is that would be nice to know.

Control numbers are numbers between 0-99. They are used to reference one of the 100 available sprites. Control number 0 is used for sprite 1. Control number 1 is used for sprite 2 ... Control number 99 is used for sprite 100.

Example: I have two characters on my screen. Character 1 is a dog, and character 2 is a cat. In my sprites, I have drawn the dog at sprite character number 12 and the cat at 42.

I want to be able to have both show up on the screen. I have 100 sprites available. I choose to use control number 0 for the dog and control number 1 for the cat. I want the dog on the left side of the screen, and the cat on the right. To get them to show up, I would do this:

'Set sprite 0 to be the dog
SPSET 0,12,1,0,0,1

'Position dog on left side of screen
SPOFS 0,20,100

'Set sprite 1 to be the cat
SPSET 1,42,1,0,0,1

'Position cat on right side of screen
SPOFS 1,220,100

'Draw the screen
VSYNC 1

Does this make sense?

Earlier in the thread, I wrote a quick demo program that will assign random characters to each of the 100 sprites. Scan the code and give it a look:
https://www.nintendolife.com/forums/dsiware/petit_computer?sta...

Edited on by DrKarl

DrKarl

KAHN

@DrKarl
i guess it makes sense... tell me if i understood correctly, ok? a control number is used to reference 1 of the 100 available sprites. i can assign a control number to a sprite, and i can use that control number on other commands (SPOFS, SPHOME, etc.) so that a affect the intended sprite? am i correct? and i've scanned the QR code a couple weeks ago, actually. i was hoping i could later read the coding once i had a better understanding of sprites. so, am i correct about control numbers?

KAHN

3DS Friend Code: 1032-1301-2772 | Nintendo Network ID: Milkman12

KAHN

i've created a quite simple SPANIM program, only 4 lines long. i think it would be easier to type the code, rather than post a qr code. it's just a spinning star, though.

1| SPPAGE 0
2| SPSET 77,156,3,0,0,0
3| SPHOME 77,-125,-100
4| SPANIM 77,4,7,0

KAHN

3DS Friend Code: 1032-1301-2772 | Nintendo Network ID: Milkman12

Please login or sign up to reply to this topic