Forums

Topic: Petit Computer

Posts 321 to 340 of 9,620

Ispheria

your invisible cows look amazing lol but in all seriousness, your game looks great so far. i can't wait to play it...you will be sharing the QR code right?

Ispheria

Eel

Of course I am!
But I want to finish it before sharing it but, to be honest, I'm a slow worker so it may take some more time.

Cows can be seen, but I decided to toggle them off for the photo, for some odd reason.

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

I really want to see the final result of this Farm game! It's looking awesome already!

"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

Kemba

Morph, you should totally make a clone of one of one of these suckers. I don't want to pay 90 bucks for a new one, and my own hasn't worked in ten years. B)

Kemba

KAHN

having some trouble moving a sprite manually. earlier in the week, i achieved the checkpoint of manually moving a sprite across the screen, but there are two problems.and i've come to this specific forum for answers! (to answer the problems, please reference the code below)

1.) when i move the sprite, i TAP the right arrow key on my 3DS D-pad, and my sprite is sent whizzing to the middle of the screen. this would be fine, but if i want to make the sprite go across the screen in one move, i want to HOLD the arrow key. if i want to make him move a little bit, i want to TAP it,you know? like in real videogames!
2.) move the sprite, it has to begin somewhere right? and it has to have a destination, correct? so i can move a sprite from it's starting point to it's destination, but i can't move my sprite after i move him across the screen! i want to be able to move wherever i want on the screen! for example, i want to go here, but now i want to go here, instead. understand?

i'm sorry i didn't do a good job explaining my problems, but i did the best i could. i don't expect good answers because of my horrible explaining, either, but everything helps, i suppose. i'm posting the code below. that way it will be easier to understand my descriptions. hopefully you'll understand my problems and post the answer i'm looking for! i want input from everybody! the more answers, the better! plus, other readers might look upon this, and agree with me, looking for answers, and i'm sure they'll find all your help as appreciated and useful as i will! you can copy the code below and re-program it so that when you repost it here, i can observe it! anything goes! all input is GREATLY appreciated! whelp, here's the code:

CLEAR
CLS
PNLTYPE "OFF"
BGMPLAY 9
SPPAGE 0
SPSET 0,64,0,0,0,0
PRINT "MOVE RIGHT WITH -->"
SPOFS 0,10,100
@DERP
IF BTRIG()!=8 THEN GOTO @DERP
SPANIM 0,4,4,12
SPOFS 0,120,100,190
WAIT 220
END

so that's the code, all help is appreciated, have a good day!

KAHN

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

Eel

It seems that you need to make it move in relation to it's position, I'd recommend you to do something like this:

example, to move 16 pixels up...
@UP
SPREAD (0),X,Y <--- Reads SP 0's position and stores the coordinates in the variables X and Y
SPOFS 0,X,Y-16,(here goes the number of frames you want it to take to move from its position to this position, no need to use "wait", after it)
RETURN
You need to make one for each direction

Edited on by Eel

Bloop.

<My slightly less dead youtube channel>

SMM2 Maker ID: 69R-F81-NLG

My Nintendo: Abgarok | Nintendo Network ID: Abgarok

heatguts

i cannot seem to wrap my head around sprites.

also, i seem to be having some problems with the if command.

Edited on by heatguts

So what if there's no Mega Mans in Metroid?
That doesn't mean we can't have metroids in Mega Man.

3DS Friend Code: 4511-1723-4299

Ispheria

Morphtroid wrote:

It seems that you need to make it move in relation to it's position, I'd recommend you to do something like this:

example, to move 16 pixels up...
@UP
SPREAD (0),X,Y <--- Reads SP 0's position and stores the coordinates in the variables X and Y
SPOFS 0,X,Y-16,(here goes the number of frames you want it to take to move from its position to this position, no need to use "wait", after it)
RETURN
You need to make one for each direction

how do you do something like this but get it to animate too?
like make it look like the person is walking?

Ispheria

Ispheria

CLS
ACLS
VISIBLE 1,0,1,1,1,1
SPPAGE 0
SPSET 1,80,2,0,0,0,16,16
SPHOME 1,-5,-8
SPSET 0,70,2,0,0,0,16,16
X=120
Y=90
POSX=X
POSY=Y
@UPDATE
B=BUTTON()
IF (B AND 32) THEN END
IF (B AND 1) THEN GOSUB @UP
IF (B AND 2) THEN GOSUB @DOWN
IF (B AND 4) THEN GOSUB @LEFT
IF (B AND 8) THEN GOSUB @RIGHT
SPOFS 0,X,Y,1
WAIT 1
IF TCHST==TRUE THEN GOTO @TOUCH
IF TCHST==FALSE THEN GOTO @UPDATE
@TOUCH
IF TCHX<100 THEN GOSUB @LEFT
IF TCHX>140 THEN GOSUB @RIGHT
IF TCHY<70 THEN GOSUB @UP
IF TCHY>110 THEN GOSUB @DOWN
SPOFS 0,X,Y,1
WAIT 1
GOTO @UPDATE

@UP
IF Y<0 THEN Y=0
Y=Y-1
SPCHR 0,78
SPANIM 0,1,15,0
IF TCHY<24 THEN Y=Y-1
SPOFS 0,X,Y,1
RETURN

@DOWN, @ LEFT, @RIGHT ARE PRETTY MUCH THE SAME THING EXCEPT WITH DIFFERENT VARIABLES

thats what my code for making the character move basically looks like atm, and when i move the character, it changes to the right sprite, but it doesn't animate. any ideas?

Ispheria

heatguts

maybe you should put another SPANIM in the beginning of update.
to change it back to the original costume.

So what if there's no Mega Mans in Metroid?
That doesn't mean we can't have metroids in Mega Man.

3DS Friend Code: 4511-1723-4299

ejamer

Ispheria wrote:

...
thats what my code for making the character move basically looks like atm, and when i move the character, it changes to the right sprite, but it doesn't animate. any ideas?

If you were to post a QR code, I'd try to help. I'm not really wiling to type all that code in to troubleshoot though.
Someone more familiar with sprites might be able to make a recommendation just by looking.

(My guess, and what I would test first, is changing the number of frames in your SPANIM statement from 1 to something bigger. Otherwise it's just cycling through the same sprite all the time instead of actually changing anything... right? Maybe I'm offbase here, which is why I would've preferred to test before commenting.)

Edited on by ejamer

ejamer

Nintendo Network ID: ejamer

Peidorrento

Hello there,
I'll be more specific about my DATA problem. If anyone could sheed some light, I'll appreciate.
I want to display a map made of different sprites, say, a 16x16 sprites map using DATA command. Is this possible?
If it is, can someone please give me a sample routine? I can't figure by myself the correct use of DATA and READ

"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

Eel

@Peidorrento: yes you can, you just need to store numbers (either identifiers or the CHR numbers) on the DATA structure and read it from a loop.

@Ispheria: That's because you're changing sprites and setting spanims every 1 pixel you move, it's happening so fast that the sprite has no time to change frames!

Bloop.

<My slightly less dead youtube channel>

SMM2 Maker ID: 69R-F81-NLG

My Nintendo: Abgarok | Nintendo Network ID: Abgarok

Peidorrento

@Morphtroid Thanks man, but the question is: how to do that? How to retrive specific DATA? I can't understand how to organise these things...

"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

ejamer

Morphtroid wrote:

@Ispheria: That's because you're changing sprites and setting spanims every 1 pixel you move, it's happening so fast that the sprite has no time to change frames!

This is probably a good point.

@UP
IF Y<0 THEN Y=0
Y=Y-1
IF MYSPRITE!=78 THEN SPCHR 0,78: MYSPRITE=78
IF TCHY<24 THEN Y=Y-1
SPOFS 0,X,Y,1
RETURN

You could change your SPCHR line to check the current sprite being used and only change if necessary. Also, wouldn't it be better to move the SPANIM command out of the movement loop, and just leave your character always marching? Since you are using an infinite loop, I don't know why you feel the need to keep resetting those values (to identical values) every time the loop runs.

(Try moving this line just under your SPSET command maybe?)
SPANIM 0,4,15,0

Edited on by ejamer

ejamer

Nintendo Network ID: ejamer

ejamer

Peidorrento wrote:

@Morphtroid Thanks man, but the question is: how to do that? How to retrive specific DATA? I can't understand how to organise these things...

DATA can be anywhere in your program - although I'm guessing they should probably be placed after the END statement.

DATA statements won't have any effect on your code or program unless a READ command is used. When you use a READ command, it returns the first DATA value found in the program, starting to search from the beginning. If you want to start reading from a different location, add an @data_label just before the DATA statements you want to jump to, and then use the RESTORE @data_label command before the READ so that it will start looking for DATA from that location.

Does that help? Use can always look at the manual for details (unofficial online version here: http://petitcomputer.wikispaces.com/ ) about the commands or LOAD "GAME2" and check the source code to see how they used the RESTORE-READ-DATA commands to create a level map in an actual program.

Edited on by ejamer

ejamer

Nintendo Network ID: ejamer

Peidorrento

Hey @ejamer, thanks a lot! It always helps. Still, it seems really messy to me how to use all this data which I store. I loaded lots of exemples but I couldn't figure. I realise that it is possible to store different data types (char or numbers), but I don't understand how to use them in an apropriate way.

For exemple, in all my naivety, this code should work
DATA 1, 2, 3
READ a, b, c
so I should get a = 1, b = 2 and c = 3. but it is not the case. I'm really confused

I will load this "GAME2" and see if the code is more like "DATA for dummies", which is what I'm looking for

EDIT: And thanks for the link!

EDIT2: I'm going to be even more specific: I want to store x and y positions for my sprites and retrive them.

EDIT3: Just checked "GAME2" code. It is exactly what I was looking for. Thanks all!

Edited on by Peidorrento

"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

Sprite

Created Cool Pixel map but Newb to programing so can't program myself. Could anyone do it for me? If anyone doses could you try to keep the graphics the same. When someone responds I will post QR code. PS LOVE Petit Farm

I'm not saying let's kill all the stupid people, I'm just saying let's take off the warning labels, and see what happens.
Friend Code: 1075-1228-4183

TheDreamingHawk

Anyone have a guide to SMILEBasic, please? I can only read a little Kanji, but not enough to understand the guide.

A Supporter of Reggie Fils-Aime and Respectful opinions
Pokemon black 2 FC: 1808 0259 1596

3DS Friend Code: 4725-7951-6337 | Nintendo Network ID: TheDreaminHawk

Eel

Why would you need to read kanji to understand the manual?

About READ and DATA: I don't think you can read more tha one variable at once.
If you have
DATA 1,2,3
then you must use
READ a
READ b
READ c

You can also use loops and stuff like that to read it.
Oh and RESTORE is VERY useful, you use it with labels to tell the program where the DATA is.

Bloop.

<My slightly less dead youtube channel>

SMM2 Maker ID: 69R-F81-NLG

My Nintendo: Abgarok | Nintendo Network ID: Abgarok

Please login or sign up to reply to this topic