トピック
Leo/Doshi♀ USA2DAY

Please help. Please teach! ^-^

So...I know this sounds rude of me, but could somebody make a file that explains how to use smilebasic past commands like print. I have been struggling for about a year now and not even the built in sys is helping much.
2そうだね
プレイ済み
返信[1]
親投稿
Jacob KulcakKid4
If you've been struggling to get past print for a year, you could've looked up tutorials on YouTube or smile basic source. I know there are at least two people that will probably respond to this post to help you.
2そうだね
プレイ済み
返信[2]
親投稿
*J.P.*[P]£ aj2003aj
*SGT *J.P.* REPORTING FOR ACTIVE CODING HELP DUTY!* anyways so lets begin on my favorite topic ARRAYS AND DATA LOAD/SAVE! jkjk. sprites, amazing creatures that feed off of X/Y :o ok spset sets the sprite, there will be two numbers after that, the first is the management number, this is what will tell apart your sprites can be anything from 0 to like 512 i think, (i would start with 0 btw) so tbc
0そうだね
プレイ済み
返信[3]
親投稿
*J.P.*[P]£ aj2003aj
then the 2nd number is the definition number, found in smile tool under SP. so you would do (always put ACLS at the begining of your code) ACLS SPSET 0,0 this would set a strawberry in the top corner, now to move it out of the corner you would use SPOFS so first you put the management number of the sprite you want to move then the X,Y. like SPOFS 0,100,100 many other easy to learn sprite
0そうだね
プレイ済み
返信[4]
親投稿
*J.P.*[P]£ aj2003aj
commands you can see just type SP and see the stuff that come up and push the help button to learn about them. lastly ill teach you INC/DEC this INCorporates a variable by one DEC is the same but make it go down so its the variable you want to go down and how much you want it to go down at a time like INC X,1 used a lot for making a sprite move.
0そうだね
プレイ済み
返信[5]
親投稿
Leo/Doshi♀ USA2DAY
Thank you mucn JP. I know about sprites, but i have other(thousands) of problems. Like I don't know how to get a sprite to float up and down unless a button is pushed. Spanim and inc and dec don't seem to work for that. Other problems include finding wait commands that still allow you to do things within that time. I also have trouble figuring out how to multiple sprites that are the same without
0そうだね
プレイ済み
返信[6]
親投稿
Leo/Doshi♀ USA2DAY
wasting management numbers. Like if I want there to be coins in a mission. I also can't figure out how to get my sprite to stop when in contact with the ground.
0そうだね
プレイ済み
返信[7]
親投稿
*J.P.*[P]£ aj2003aj
ok so moving a sprite..? here is a simple code ACLS X=0:Y=0 WHILE 1 SPSET 0,0 SPOFS 0,X,Y IF BUTTON() AND #UP THEN DEC X,1 IF BUTTON() AND #DOWN THEN INC X,1 IF BUTTON() AND #RIGHT THEN INC Y,1 IF BUTTON() AND #X THEN DEC Y,1 WEND ^might have messed up the x/y but thats basically how you would simply do it^ tbc
0そうだね
プレイ済み
返信[8]
親投稿
Leo/Doshi♀ USA2DAY
Thanks, but i said, if the button is NOT pushed, then the sprite automatically floats up and down like a ghoust UNLESS a button is pushed. Sorry for my bad wording snd wasting your posts.
0そうだね
プレイ済み
返信[9]
親投稿
*J.P.*[P]£ aj2003aj
oh oops sorry add in VSYNC after WHILE 1 next theres wait, almost NEVER use WAIT in an active program with moving in it, instead use a INC/DEC loop like: IF BUTTON() AND #A THEN REPEAT VSYNC INC WAITS,1 UNTIL WAITS==100 ENDIF or something like that lol. for stopping on the ground.. what does that mean..? there is no ground, do you mean a bgtile or the screen or a sprite..? what? tbc
0そうだね
プレイ済み
返信[10]
親投稿
Leo/Doshi♀ USA2DAY
I meant bg
0そうだね
プレイ済み
返信[11]
親投稿
Leo/Doshi♀ USA2DAY
Also, if your interested, see my latest posts ( about to post a second.
0そうだね
プレイ済み
返信[12]
親投稿
*J.P.*[P]£ aj2003aj
for a ghost like thing you could use INC still in a if loop. but i would have to do same testing as this isn't the easiest thing for mutiple sprites you use a for loop like so (ill be setting up 50 random sprites) FOR I=0 TO 49 SPSET I,RND(600) SPOFS I,RND(400),RND(200) NEXT
0そうだね
プレイ済み
返信[13]
親投稿
Leo/Doshi♀ USA2DAY
What if you have specific place ideas for each sprite and don't want to use random?
0そうだね
プレイ済み
返信[14]
親投稿
*J.P.* DEV NEWPICY3
then just dont use a for loop, do a spset with its properties for each one, or there might be a way to specify the I but then why use the I at all? for BG collision you will need to use BGGET, ive never been really good at using it so maybe ask someone more experienced with using BG's
0そうだね
未プレイ
返信[15]
親投稿
Leo/Doshi♀ USA2DAY
About the sprites. I do think there is a way to do it without using more management numbers, because I see that spset was onlu used two or three times in game3jump sys program.
0そうだね
プレイ済み
返信[16]
親投稿
*J.P.*[P]£ aj2003aj
first off, the sample games were made by professional game makers (mainly) and dont really count, basically one spset for the title screen, one for main character, and one for coins and enemys which are pre set by msking a variable for each one containing the x/y and sprite. basically, dont go by the samples.
1そうだね
プレイ済み
返信[17]
親投稿
Stewart segludian1
You only get 512 sprites active at a time between both screens. You can however dispose of a sprite and make a new one. It sounds like you are having problems with simulation and the game loop. Sprites aren't going to bump into walls or land on platforms unless you make them do so. You have to simulate the rules and physics of you game world (it is not as bad as that sounds -- mostly).
0そうだね
プレイ済み
返信[18]
親投稿
Stewart segludian1
You keep everything moving independently with the game loop. You have a loop that runs over and over. Each frame is 1/60th of a second (hopefully) so you need to figure out how much and where things moved since the last frame. Normally you will keep track of your game world object in an array and loop over them in your game loop applying update logic for each one. See example on previous post.
0そうだね
プレイ済み
返信[19]
親投稿
Stewart segludian1
That being said, if you are having problems with fundamentals like PRINT, you shouldn't be making sprite based games yet. Move on to those after you have things like: guess the number, hangman, and tic tac toe working. Oh, and INC is for increment, and DEC is for decrement basically adding or subtacting 1 from a number. If you have more questions feel free to ask. It isn't rude to ask.
0そうだね
プレイ済み
返信[20]
親投稿
Leo/Doshi♀ USA2DAY
Thank you. I know how to print. A problem I have is figuring out how to use arrays and what exactly I can use them for. The only thing I know about them is how to load a bgmap to it and that's it. Could you help me with that?
0そうだね
プレイ済み
返信[21]
親投稿
Stewart segludian1
Arrays are important. You will want one in SmileBasic whenever you are working with a list or grid of data. Or whenever you have a lot of something and a way to access it is more important than an individual name. Let's look at tic tac toe (or noughts and crosses if you prefer). You have a 3 by 3 grid where players take alternating turns placing an X or an O.
0そうだね
プレイ済み
返信[22]
親投稿
Stewart segludian1
How will you keep tack of the game board? Without an array you would have to have 9 variables Board1 to Board9, or maybe Board11 to Board33 if you want to have implied rows and columns. With arrays you could just declare Board[9], or perhaps better Board[3,3]. Now lets say you want to check for three in a row horizontally or vertically. With arrays you can do two for loops one that looks at rows
0そうだね
プレイ済み
返信[23]
親投稿
Stewart segludian1
and another for columns for i = 0 to 2 if board[i, 0] ==board[i, 1] and board[i, 1] ==board[i, 2] and board[i, 0] != blank then 'we have a match endif next i for example. If you don't have arrays you will need to code that check three times since each square is its own variable and has different names. Triple the work. Arrays make the code easier to read understand and maintain since you
0そうだね
プレイ済み
返信[24]
親投稿
Stewart segludian1
write less and easier to follow code. Just think how bad it would be if you were doing something like checkers on a 8 by 8 grid without an array. Lets look at the other examples I said you should try. In hangman you want to keep track of what letters have been guessed already. You could have 26 variables a_guessed, b_guessed, through z_guessed and so on, or you could have an array of guessed
0そうだね
プレイ済み
返信[25]
親投稿
Stewart segludian1
characters and loop through that to see if a guess is a repeat. You could use a sting for that too, but a string in SmileBasic is really just a special kind of character array. Finally in guess the number you may want to save the guesses and print them out. That is easier to do if you save them in an array then if you have a bunch of guess_1 through guess_10 variables. You could just push and pop
0そうだね
プレイ済み
返信[26]
親投稿
Stewart segludian1
From an array instead. If your game generated a bunch of enemies over time it would likewise be good to put them in an array to loop over to update and such. Unfortunately we don't have user defined types in smilebasic so we often have to make a bunch of arrays to keep track of things with multiple fields that may have different data types. Hope that all makes sense.
0そうだね
プレイ済み
返信[27]
親投稿
Leo/Doshi♀ USA2DAY
THANKS. Sorry it took so many of your posts
2そうだね
プレイ済み