トピック
King 5kittens645

Sprites and maps...

Well, i feel like learning how to use maps and sprites and all of that other stuff since my next idea for a game will require them. So, if anyone has any tips or if anyone would like to help then please do help me! Help is appreciated! - King
1そうだね
プレイ済み
返信[1]
親投稿
Jacob KulcakKid4
Huh, sprites are like the first thing most people learn for SB (from what I've seen). But, yeah, I can help you with sprites, and I would for maps, but that's a little more complicated and I wouldn't be very good on explaining them. Sprites in next post
1そうだね
プレイ済み
返信[2]
親投稿
Jacob KulcakKid4
So first you need to make the sprite. You can do this with SPSET. You'll need to put SPSET 0/basically the name that you give it, but can only be a number. 50/the actual sprite number that you pick from the smile tool. So it's: SPSET 0,50. Then you use SPOFS to set it's location: SPOFS 0/ the "name" you gave it. 50/x-point. 50/y-point: SPOFS 0,50,50 SPOFS is basically the LOCATE for sprites
0そうだね
プレイ済み
返信[3]
親投稿
Jacob KulcakKid4
There are several other sprite commands, and I can tell you about quite a few more if want.
0そうだね
プレイ済み
返信[4]
親投稿
King 5kittens645
Oh, i never fully understood sprites so now it makes a little more sense. If you could, could you go through those other sprite commands? The reason i didn't learn about sprites first was because it was too complicated for me.
2そうだね
プレイ済み
返信[5]
親投稿
*J.P.* DEV NEWPICY3
so whenever using a sprite commands you always start with the management number of it, which is the number you put in your spset like SPSET 0,1 or whatever so another command is spscale, just put the management number and how big, like SPSCALE 0,2,2 if you do 1,1 then it will stay the same btw. next is sphome, as always you put the management number first then it gets a bit more complicated. so a
1そうだね
未プレイ
返信[6]
親投稿
*J.P.* DEV NEWPICY3
normal sprite is 16x16 so for a 16x16 sprite you would be sphome 0,8,8 it basically sets the middle of your sprite and is really useful. next is sprot, this one rotates the sprite, its best to use sphome with this for smoother turning so like SPROT 0 (deg you want turned, 360 at most) SPROT 0,180 so I gtg be back later tell me if this helped
1そうだね
未プレイ
返信[7]
親投稿
King 5kittens645
Uh... I'm already confused, but i'll try to actually understand later...
1そうだね
プレイ済み
返信[8]
親投稿
Jacob KulcakKid4
So I probably should've mentioned, the "name" that I said you give your sprite is called it's management number. Ok. So another SP command is SPCOL and SPHITSP. I said them together because.. well they're used together. So for SPCOLission, it basically tells your program that that sprite is expected to run into another. It would be put: SPCOL 0/management number. next post
0そうだね
プレイ済み
返信[9]
親投稿
Jacob KulcakKid4
Yeah, it's that simple. (wish I had known how simple it was) ((brings back memories of "figuring it out" with J.P (we never really did until someone helped) ANYWAYS, SPHITSP. It's also really simple. It goes like this IF SPHITSP (0,1) THEN whatever you want it to do. The zero and one are just the management numbers of the two sprites you want to collide.
1そうだね
プレイ済み
返信[10]
親投稿
Jacob KulcakKid4
If you need me explain more, just ask what.
1そうだね
プレイ済み
返信[11]
親投稿
King 5kittens645
Alright, so you see this? I would like to make something similar to it where you can pick up items and use them on something later. For the most part it wouldn't be hard, but sprites and maps would be the only problem. I'm just not sure how i will make my idea into a reality...
1そうだね
プレイ済み
返信[12]
親投稿
*J.P.* DEV NEWPICY3
so to do this you set a variable for every item and set it to 0, like APPLE=0 LIGHTBULB=0 CANDY=0 stuff like that, then you would do spcollision as listed above and when touching do something like IF SPHITSP(0,1) THEN CANDY=1:SPHIDE 1 '1 being the candy to make it disappear then when using the item do a if, like IF CANDY==1 THEN (something)maybe add if a button is pressed,which is very easy too
1そうだね
未プレイ
返信[13]
親投稿
Stewart segludian1
Lets talk about some background basics. Tilemap backgrounds in SmileBasic are surpisingly similar to the text mode character screen. The individual tiles are like a character except you get more colors and more of them. The tiles like a character can only be placed at certain locations on the grid, just like text. However unlike text you can have multiple layers (with trasparency).
1そうだね
プレイ済み
返信[14]
親投稿
Stewart segludian1
You can also change the width and height of layers. The layers can be moved around at a pixel level too. Doing so you can create scrolling. If you use multiple layers you can move them around at different rates to get parallax scrolling. To give a better illusion of depth. You get up to 4 layers of background between both of the 3DSs screens. BGSCREEN layer_number, width, height will setup the
1そうだね
プレイ済み
返信[15]
親投稿
Stewart segludian1
layer's width and height. You use BGPUT layer_number, x, y, tile_id to put the tile tile_id at position x, and y on the layer. Note this is in tile coordinates not pixels by default. You can use BGGET layer_number, x, y, tile_val to read the tile at x, y on layer tile_layer and save it to the variable tile_val. You move layers around with BGOFS layer_number, x, y to move a layer around so x, y
1そうだね
プレイ済み
返信[16]
親投稿
Stewart segludian1
on the bg layer is at the top left of the screen. You can also do things like rotate layers but try the basics out first. If you have scrolling you will probably want functions to map between background and screen coordinate and between tile and pixel coordinates. It can get confusing. Sprites unlike background tiles can be placed at a specific pixel coordinate on screen and move independently.
1そうだね
プレイ済み
返信[17]
親投稿
Stewart segludian1
SmileBasic has a built in map editor, but it is limited to a set size. Reading data from file can be difficult too. You could also create your own custom map editor and file format or just stuff the tiles you want in data statements. Hope that helps for backgrounds let me know if you have questions.
1そうだね
プレイ済み