DSiWare Forum

Topic: Petit Computer

Showing 198 to 217 of 9,519

AuthorMessage
Avatar

KAHN

198. Posted:

am i the only one around here who can't figure out how to place and move a sprite?

KAHN

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

AuthorMessage
Avatar

DrKarl

199. Posted:

Halo_MASTER wrote:

am i the only one around here who can't figure out how to place and move a sprite?

I've updated the code above to help you get started. Here is the QR code:
Untitled

Make note of these two functions: SPSET & SPOFS

SPSET will link a sprite to a control number. The control number can be 0-99. In the example above, I set a random character to each of the control numbers.

SPOFS will offset a sprite to a location on the screen. For each sprite in the Demo, I placed it at a random location on the upper screen.

I then give each sprite a random destination and run through the animation loop until each sprite has made it to its destination. Then the program ends.

Edited on by DrKarl

DrKarl

AuthorMessage
Avatar

JohnDoe123

200. Posted:

This move sprite stuff is kiling me. I think I'll just do it the long way of using SPOFS and wait a bunch of times. I only have to move 4 sprites on the x axis halfway across the screen. The only issue I can see occuring is that I have to get on of the objects to move forward at a button press and also continue moving forward and then go back at the end of the animation, like a forward stab. Can't wait for that.

JohnDoe123

3DS Friend Code: 0259-0286-9394

AuthorMessage
Avatar

DrKarl

201. Posted:

EmpireIndustries wrote:

This move sprite stuff is kiling me. I think I'll just do it the long way of using SPOFS and wait a bunch of times.

I may be missing something, but it sounds to me like you are not doing a VSYNC after the SPOFS.

Try a VSYNC 1 as the next line of code after each one of your SPOFS statements. That should get it sort of working for you, and might get you to see how it all works. Later, you can change it to only do a VSYNC at the exact time you need to.


Imagine that VSYNC is like the trigger for a camera, and you are making a stop motion movie. What you want to do is use SPOFS to position all of your sprites(characters) in the scene to the exact location you want them to be. As soon as everything is in position you call VSYNC 1 (Take one picture of the scene and display it on the screen).

Now you as the animator need to re-position all of your characters for the next frame. Some stuff may not be moving and won't need any changes, but other stuff will have moved between the last frame and this one. Once again, use SPOFS to position all of your characters and do a VSYNC 1 again to snap the picture and display it on the screen.

And so on and so on...

In the example program that I posted above you can see this in action. The loop will adjust the position of each of the 100 sprites. It then does a VSYNC 1 to draw the frame. The loop runs again, positioning all of the sprites, and then VSYNC 1 again to draw the frame. The loop continues until all of the sprites have reached their destination. If you look close at the code, you will see that although each sprite has an SPOFS call for each loop, the sprite will only be moved (by 1 pixel in each direction) if it is not currently at its destination.

Edited on by DrKarl

DrKarl

AuthorMessage
Avatar

JohnDoe123

202. Posted:

@DrKarl Thanks again! I'm just about done now.

JohnDoe123

3DS Friend Code: 0259-0286-9394

AuthorMessage
Avatar

Kemba

203. Posted:

I've been lurking here for a while, as I was poking at UncleSporky's text adventure skeleton. I decided to make my own and while that's in progress, I used the GRP editor to make some background pictures for the adventure....
I don't know BASIC too well. Is there a way to call these GRPs to be backgrounds in the game? If so, how?
Say, for example I saved one of the GRP's as "Desert", how can I call that in my game to display on the screen, under the text?

Kemba

AuthorMessage
Avatar

Morpheel

204. Posted:

Just load them with the load command.

LOAD"GRPx:Desert"

With the x being any number from 0 to 3.

Oops, no username pun.

Oh look! A Morphloggery.
Oh! eShop Gurus.

3DS Friend Code: 0173-1330-0080 | Nintendo Network ID: Abgarok

AuthorMessage
Avatar

Kemba

205. Posted:

Morphtroid wrote:

Just load them with the load command.

LOAD"GRPx:Desert"

With the x being any number from 0 to 3.

Oh.

Awesome. Thanks a lot. I'll try it out as soon as I stop hating myself for biting this jalapeno pepper.

Okay so if I type that in an empty program it works, however;

In the text adventure, I want to call desert in as the background for Page 1.

so far it looks like

Data 0
Load "GRP0:Desert"
Data "Welcome to Anubis' Tale"
DATA "You awaken in the desert"
DATA "It's dry, and it's hot."
DATA "In the distance you see a figure."
DATA "What do you do?"
Data ""
'end the page'
DATA "STOP"
DATA 2."Get up and follow the figure"
DATA 3,"Close your eyes"
DATA 4,"Shout to it"
DATA 5,"Look for nearby water"

-
that being said, it doesn't seem to do anything with the background, it just sits on the usual blakc background white text. Sorry for being a noob. </3

Looking over UncleSporky's notes, maybe it has to do with one of the comments he put in... I'll try some things

Edit #3: Sporky's special calls that he used to play BGM are, what I believe, I need to call the image.

It looks like this.

@S2
'play a song
BGMPLAY 0
RETURN

@S3
'Stop the music
BGMSTOP
RETURN

So I figured I would try
@S4
'Load Backdrop
LOAD "GRP0: DESERT"
RETURN

But it doesn't work, and when I type DATA 4 it just displays the number four. I'm not having much luck.

Edited on by Kemba

Kemba

AuthorMessage
Avatar

Morpheel

206. Posted:

Hmm I'm not sure if DATA has anything to do with loading images O.o

Are you sure the backdrop is loading? Do you use GCLS (or whatever the command was) anywhere after you load it?
I would try and help you out more, but my 3DS is dead and I can't find the charger right now.

Oops, no username pun.

Oh look! A Morphloggery.
Oh! eShop Gurus.

3DS Friend Code: 0173-1330-0080 | Nintendo Network ID: Abgarok

AuthorMessage
Avatar

Kemba

207. Posted:

Morphtroid wrote:

Hmm I'm not sure if DATA has anything to do with loading images O.o

Are you sure the backdrop is loading? Do you use GCLS (or whatever the command was) anywhere after you load it?
I would try and help you out more, but my 3DS is dead and I can't find the charger right now.

[/div]

Haha, it's okay I'm glad that you're trying, at least.
And, I am not too familiar with it, but I will look through the program for a GCLS command. See, what the skeleton is like, is...
Every sentence instead of being put in from print ...
DATA "Hello there" to output the text and
DATA 1, "Walk left"

to take you to page @1 where it could say
Data "There isn't anything to the left."
Data 2,"Oh. That sucks."

@2
Data "Yeah, it does."

Anyway, he seems to use @S2 to make the music callable when he types DATA 2... It's really confusing to me. :(

As far as I can tell looking at the skeleton, the only Clear screen command is on line ten. (I only know CLS from Turing. high school was good for something, surprisingly.) The @S# declarations start on line 80. After that it seems as easy as
@#(Page #)
Data <Page text>
Data ##(Destination page #)

Edited on by Kemba

Kemba

AuthorMessage
Avatar

Peidorrento

208. Posted:

Finally figured how to use custom sprites. I will post my program soon :)

"A vingança nunca é plena, mata a alma e a envenena" - Seu Madruga
Presidente, CEO, Programador e único empregado da Peidosoft.

AuthorMessage
Avatar

JohnDoe123

209. Posted:

Practically finished now, just this one last command before I'm (hopefully) done. But the last command I need to use isn't working and I can't quite figure out why. I have an SPREAD command that keeps giving me a missing operand error. I've tried a few things but it gives me the same error every time. What does it need to function at the most basic level? I only need X and Y coordinates.

JohnDoe123

3DS Friend Code: 0259-0286-9394

AuthorMessage
Avatar

Taya

210. Posted:

I have also finally figured out sprites. I feel like I just split the atom.

Taya

AuthorMessage
Avatar

Kemba

211. Posted:

Taya wrote:

I have also finally figured out sprites. I feel like I just split the atom.

Next stop: help me figure out my issue. Haha
I have been poking at this for a few hours now (DS is plugged in while I do just to avoid it's death.)
My brain is rattled, I can't figure it out.

Kemba

AuthorMessage
Avatar

Taya

212. Posted:

Actually it turns out I DON'T know how to load sprites.

It was working, but then I closed the program and reloaded it. Now it's displaying a default sprite instead of my custom one. I tried to load the CHR file that I saved using LOAD "SPU0:NAME" and it didn't work. I wonder what I did to get it to work the first time.

Taya

AuthorMessage
Avatar

Morpheel

213. Posted:

Kemba wrote:

Taya wrote:

I have also finally figured out sprites. I feel like I just split the atom.

[/div]

Next stop: help me figure out my issue. Haha
I have been poking at this for a few hours now (DS is plugged in while I do just to avoid it's death.)
My brain is rattled, I can't figure it out.

[/div]

I know! Try loading it to the GRP layer 1, not the 0.

@Taya: You sure it is being loaded on the correct SPR page?

Edited on by Morpheel

Oops, no username pun.

Oh look! A Morphloggery.
Oh! eShop Gurus.

3DS Friend Code: 0173-1330-0080 | Nintendo Network ID: Abgarok

AuthorMessage
Avatar

Kemba

214. Posted:

WOW I feel stupid now. I thought the # was some sort of limiter on how many images could be used.

Wow.

I am sorry I wasted all that time, jeez... Now I feel daft. Thank you, Morphtroid!!

Edit > I tried that, and it won't display anything. Tried all the layers now. Should I call it before or after the text, or would that matter? :s
Edit #2 > Messed around a bit and declared it through the special stuff, and it did open the loading screen. Said loading complete, when I pressed OK it just went to normal black screen, white text. Does the load screen need a parameter to choose the display screen, or maybe I just screwed up the GRP in the editor...

Edited on by Kemba

Kemba

AuthorMessage
Avatar

Taya

215. Posted:

Yyyynope it turns out you're right. I was loading the wrong page. Changed it to LOAD "SPU3:NAME" and it's working again.

Thank you, programming wizard.

Taya

AuthorMessage
Avatar

Morpheel

216. Posted:

@Kemba: I'm pretty sure loading it to the 1st layer makes it show on the touch screen, try changing the PNLTYPE to "OFF" at the start of your code and see what happens. If that fails then uploading a QR for your code (or the complete code itself written in a post) would be helpful to try and see what's happening myself.

Also, does your code include the command "VISIBLE"? That is used to show or hide "screen layers" (Console, panel, graphic, sprite, background, etc)

@Taya: Haha thanks, I'm glad that worked.

Edited on by Morpheel

Oops, no username pun.

Oh look! A Morphloggery.
Oh! eShop Gurus.

3DS Friend Code: 0173-1330-0080 | Nintendo Network ID: Abgarok

AuthorMessage
Avatar

Kemba

217. Posted:

Sweet! Now the top screen has the words and the bottom screen has the graphic. This is perfect! Thanks a lot, man!

Also, I look forward to your harvest moon clone. ;D
Edit: time to draw 56+ backgrounds.

Oh boy, what have I gotten myself into...

Edited on by Kemba

Kemba