One thing you forgot to write is what do you want to do.
Try to not follow the example of smilebasic. This sound bad but it's because they use goto and gosub anywhere and that make the code hard to understand.
You should start to use DEF to create function. Like most programming language, there is a Function Scope for the variables. This mean that if you create variables using var or dim inside a function, they will be bind to it and will exist while the function is running. Also, you could name it with the same name as variable outside the function and if you edit them, only the variable inside will be affected.
Also, you should try to modularize your code. This could be achieved with lowerdash beta. I know that you will find hard to use it at first but it's worth to try because you could isolate your code in small files that will focus on certain task of the game. For example, I do files for map, player, enemy, bullets, etc and isolate each one in a file.
Finally, this isn't related with smilebasic, but you should try to learn design patterns. These are reusable templates to solve common problems. Here is a page with useful patterns applied into games: http://gameprogrammingpatterns.com/contents.html
This is what I know, how do I go higher in learning this language?
Root / Programming Questions / [.]
ssunlimitedCreated:
Please help me to become better at this language.
I know if, for and while, goto and how to create variables. I also know SPANIM, SPOFS, SPSCALE(I think), SPCOL.
I have created a program that asks you for your age then prints out if you can vote or not based on whether you're over 18 or not.
I have also created a flying bird graphic with a lot of help of a youtube video that teaches how to do that. I managed to change the program so that the bird will flap it's wings only when you move it using the directional buttons.
I have also created an automatic ai vs ai dice game where a dice is rolled and it says which ai has won it. But I called the ais Player 1 and Player 2.
raimondz answer was more like helpful tips. I want to be able to learn to do things such as shoot projectiles, jump(in isometric games), be able to die, be able to choose from options, be able to put extended maps that I can walk in from topdown and isometric and more.
I know if, for and while, goto and how to create variables. I also know SPANIM, SPOFS, SPSCALE(I think), SPCOL.I'm not trying to be rude, but I've never understood this mindset. To me its like saying: "I know how to use a paintbrush and what the color blue looks like. How do I paint a picture?" You're going to have to figure out what you want to make and actually attempt to make it. Understanding what SPOFS is, is great; but in order to use it well, you're going to have to understand "I want my sprite to move to this location." You have to think about the problem, not the language - commands are easy to search for in the reference once you know what you want to do. Perhaps my advice should be: Pick a project you're passionate about and won't mind taking months to ramp up to. The painting metaphor is actually fairly apt. You never build a game outright. A game is the combination of the interactions between all the moving parts. Just like in a painting, you would paint a base coat, rough in your colors, and only then start adding detail. Tackle what you know you can, and try to build on it. You'll find yourself learning. The painting will start taking shape on its own. To get you brainstorming, lets look at the parts you have right now: 1. You have a bird the player can control 2. You can check if a number is high enough 3. You know how to generate random numbers Off the top of my head: Use the random numbers to pick random locations on screen and place a coin. When the player's bird has collected enough coins (the number is high enough), move on to the next level. What's on the next level? More coins? A red background? Enemies? Time to let your creativity shine.
You don't understand. I don't learn well like that. I learn best when someone teaches me. I get As and Bs in college programming courses from good professors. I need someone to explain it to me. I can't learn on my own mostly, except from a good book like a Pearson-published book. I need it explained well, in detail what each command does, the syntax, the algorithms etc... That's how I learn best. I was spending hours learning just a few SB commands and still learned very little. Petit Professor's videos were an improvement but still not something ideal for me, but at least it was close. I would give it a grade of around B- for how well Petit Professor taught me in his Youtube videos.
You don't understand. I don't learn well like that. I learn best when someone teaches me. I get As and Bs in college programming courses from good professors. I need someone to explain it to me. I can't learn on my own mostly, except from a good book like a Pearson-published book. I need it explained well, in detail what each command does, the syntax, the algorithms etc... That's how I learn best. I was spending hours learning just a few SB commands and still learned very little. Petit Professor's videos were an improvement but still not something ideal for me, but at least it was close. I would give it a grade of around B- for how well Petit Professor taught me in his Youtube videos.This is a very pretentious thing to say. You're going to have to ask more specific questions for us to be able to help you. In order to have specific questions, you're going to have to try something.
The notebook, use it to write down notes of what you've learned, will learn and want to learn. I have a notebook that when I learn something new from here on the chat or in the manual, I write it down in my own words in my notebook. It's like a textbook especially for you. Try it out! It's great for game concepts and new commands and game keys.
raimondz answer was more like helpful tips. I want to be able to learn to do things such as shoot projectiles, jump(in isometric games), be able to die, be able to choose from options, be able to put extended maps that I can walk in from topdown and isometric and more.Those things aren't related to become better in smilebasic. It's about how to mold your ideas into game mechanics. To do so, try to think in a list of step to simulate those mechanics. For example, for projectile mechanic here is a Pseudocode:
while the game is running if player press shoot button. create bullet in the player position set the direction of the bullet equal to the player direction set a lifetime for the bullet end if if the bullet is alive if the lifetime of the bullet is 0 or the bullet hit something kill the bullet else reduce lifetime of the bullet move the bullet in the direction stored end if end whileAs you can see, I only expressed my idea in words but it can be translated into smilebasic commands. If you want to see how it work, you could check my programs. Remember that smilebasic(and any program language) is just a tool. What you can make with that tool depends on how you could put your ideas into an algorithm: a serie of instructions and decisions. Then you could translate those into commands of the language. I would recommend you to start by checking the game loop pattern on the page I posted above. This will teach you about multi tasking and is a must to create games because it tell you how to handle more than one action.
You don't understand. I don't learn well like that. I learn best when someone teaches me. I get As and Bs in college programming courses from good professors. I need someone to explain it to me. ...This way of learning is really only applicable to school. No one will give you a grade or a pop quiz in SmileBASIC, and you're not learning it to make a number bigger. You're learning it so you can make stuff with it - presumably games. The only way to learn how to do that is to start working on a game - even a simple one. A tutor can't help you with that.
So I'll assume you're still in college, but you need to start thinking about what happens after you graduate and get a job, whether it's in the food industry, health sector, business, IT... whatever. You may be assigned an experienced coworker to shadow around, but they are NOT going to hold your hands. They'll show you the general ropes and expect you to pick things up on the way, using your creativity and quick wit. If you stay in your pedagogical mentality and ask for Pearson-textbook-style-step-by-step-spoonfeeding, you won't last long at your job, trust me.
SB is the same. I have a friend who agreed to help me, but on the stipulation that only if I struggle long enough (at least 7 days) and show him the codes I came up with. Only then will he give me more hints or show me a similar example. It wasn't easy, but I don't want to be spoonfed. And that apparently is everyone's suggestion here.
Ssunlimited, do you want to learn more about specific commands or how to do some of the things you mentioned above?
Please help me to become better at this language. I know if, for and while, goto and how to create variables. I also know SPANIM, SPOFS, SPSCALE(I think), SPCOL. I have created a program that asks you for your age then prints out if you can vote or not based on whether you're over 18 or not. I have also created a flying bird graphic with a lot of help of a youtube video that teaches how to do that. I managed to change the program so that the bird will flap it's wings only when you move it using the directional buttons. I have also created an automatic ai vs ai dice game where a dice is rolled and it says which ai has won it. But I called the ais Player 1 and Player 2.Programming is not just about commands. You can pull off incredible things with the commands you know already. Learn arithmetic operations in SmileBasic. Abandon GOTO and GOSUB. Learn about functions and passing arguments to them. From there, now that you know the basics, you should focus on getting the programmer's mindset. SmileBasic is a language. It's not the same kind of language as German or Italian, but it's a language nonetheless, and it's the one the SmileBasic Application understands. You must learn how to translate English into SmileBasic. Pseudocoding like raimondz did is wonderful to assist with this. Eventually, you'll get to the point where the code almost structures itself in your head (lots of time and practice will achieve this). I will spend days doing no programming, but rather, figuring out the best angle to attempt a problem. For example, I'm about to implement objects referencing classes in Nossrec (programmer mumbo-jumbo: I'm making something very difficult). I've been pondering the best way to do this for days, and I have not written a single line of code yet. I do this because it results in more efficient and functional code (not to be confused with functional programming; "functional" as in "working correctly"). TL;DR: Learn functions and get the programming mindset.
Ssunlimited, do you want to learn more about specific commands or how to do some of the things you mentioned above?Both really. As much as possible. So I have a program of a bird on a blue screen constantly flapping it's wings. It is flying. I also made a coin appear on random places on the screen. I want to be able to grab that coin next. Other things too. But I'll start with this only for now. Pseudocode:
Make a collision when any part of the bird touches any part of the coin Add the coin to a number of coins in possession Delete the coin from the screenEDIT: Here, I did it. But I would now like to make it so that the bird flies on it's own (I think I can do that by myself using a loop and SPOFS and coordinate) but I want to make it so that I can fly to the right through the map encountering obstacles and coins. How do I do that? Here is what I did so far including coins:
ACLS X=150 Y=80 COINS=0 SPSET 0, 32, 304 SPSCALE 0, 2, 2 SPANIM 0, "UV", 10, 32, 304, 10, 48, 304, 0 SPSTOP 0 BGFILL 0, 0, 0, 50, 50, &H027F SPCOL 0, 0, 0, 16, TRUE, 255 FOR I =1 TO 5 SPSET I, 352, 64 SPOFS I, RND(350), RND(200) SPSCALE I, 2, 2 SPCOL I, 0, 0, 16, 16, TRUE, 255 NEXT @MAIN SPOFS 0, X, Y, -10 B=BUTTON() IF B AND #RIGHT THEN X=X+6 FOR I=1 TO 6 IF SPHITSP(0, I)==TRUE THEN COINS=COINS+1 SPCLR I PRINT COINS NEXT IF B AND #LEFT THEN X=X-6 FOR I=1 TO 6 IF SPHITSP(0, I)==TRUE THEN COINS=COINS+1 SPCLR I PRINT COINS NEXT IF B AND #UP THEN Y=Y+6 FOR I=1 TO 6 IF SPHITSP(0, I)==TRUE THEN COINS=COINS+1 SPCLR I PRINT COINS NEXT IF B AND #DOWN THEN Y=Y+6 FOR I=1 TO 6 IF SPHITSP(0, I)==TRUE THEN COINS=COINS+1 SPCLR I PRINT COINS NEXT SPSTART 0 WAIT 8 SPSTOP 0 VSYNC GOTO @MAIN