PlayBasic Tutorial: Intro To Functions - (2018-07-06)
Hi welcome to our Intro to Functions tutorial. In this tutorial we start out with some revision of Gosub / Return statements, which are used to create a simple sub routine. Sub routines are changes in program flow, allowing the programmer to execute a chunk of code that's external to the section they may be writing, then upon completion the control returns to the caller. This is the same basic model that functions introduction to our programming, except functions are more formalized. Meaning they have some strict rules about syntax and intro a new concepts such as scope changes, which sub routines don't have.
The types of functions shown in video are very simple, initially we start by taking a sub routine that prints rows of text and convert that to function. Through this process we encounter our first problem which is variable scope and look at ways to solve it, such as making our variable global, or better yet passing a variable into the function as a parameter . Later in the video, we create our own custom distance function, as well building a function that does some simple string manipulation
NOTE: This video was recorded alive with only a few changes for length..
PlayBasic Tutorial: From Arrays To Types (Intro To Types) - (2018-06-12)
This tutorial picks up where the previous variables to arrays tutorial left off, in that it takes the array code, demos that code then we set about converting the parallel array approach shown in the previous tutorial and we build a structure (TYPE) to hold each characters properties. Once the type has been defined that includes all the required properties, we then define a typed array that will house the collection of characters. Later in the video take a look at using typed lists also. So if your struggling with types this could be a good place to start.
Example #1 - Converting the Parallel Arrays To Typed Array
PlayBasic Code:
Setfps20
Number_Of_Characters =50type tCharacter
Xpos#
Ypos#
Xspeed#
Yspeed#
Colour
Size
endtypedim Characters(Number_Of_Characters)as tCharacter
for lp =1to Number_Of_Characters
; Allocate a newe tCharacter and place it's handle; into the Character(lp) array / container at this position
Characters(lp)=new tCharacter
Characters(lp).Xpos =rnd(800)
Characters(lp).Ypos =rnd(600)
Characters(lp).Size =rndrange(16,50)
Characters(lp).Xspeed =rndrange(-5, 5)
Characters(lp).Yspeed =rndrange(-5,5)
Characters(lp).Colour =rndrgb()next//-------------------------------------------------------//---[ MAIN LOOP ]---------------------------------------//-------------------------------------------------------doClsrgb(0,400,20)for lp =1to Number_Of_Characters
Radius = Characters(lp).Size
x#=Characters(lp).Xpos
y#=Characters(lp).Ypos
circlec X#,Y#,Radius,true,Characters(lp).Colour
x# =wrapvalue(x# + Characters(lp).Xspeed , -Radius, 800+ Radius)
y# =wrapvalue(y# + Characters(lp).Yspeed , -Radius, 600+ Radius)
Characters(lp).xpos= x#
Characters(lp).ypos= y#
nextSyncloop
Welcome, in this series of videos I take a step by step approach to creating function library in PlayBasic. The created library loads and parses XML files and is largely build on the fly, with no planning, so it's warts and all, but the goal here is to give you a birds eye view of how you might go about building your own libraries. Have fun !
PlayBasic Tutorial: From Variables To Arrays (Intro To Arrays) 2017-09-17
Welcome programmers, in this tutorial we're going to introduce the concept of arrays starting out from variables. So first we build a simple game loop that controls two characters using only variables. The characters are represented on screen as filled circles. After we get up to speed with the variable version we then move onto how we can use parallel integer arrays to store the various properties of the characters. The array version can control as many or as few characters as you like, which is the benefit of Arrays over Variables
Welcome... Today we continue with some rendering optimization ideas, focusing on a concept known as dirty rectangles in programming circles. While there's a number of different methods, in this video we look through code that uses a map as background replacement, allowing the redraw code to selectively refresh parts of the backdrop each frame instead of the whole thing. The code computes the redraw percentage each frame, which is often lower than 50%, in the sprite scene saving not only processing time by lowering a games system requirements.
PlayBasic LIVE: Basic Optimization with overview of forums (2017-04-29)
Here's a live video basically talking about the forums and code optimizations mainly.. I'm really just testing video recording on a different machine with a head set mic etc.. sadly the results are pretty sucky, but content is ok so here it is
PlayBasic LIVE - Intro to G2d (openGL for PlayBasic)
PlayBasic LIVE: Basic Optimization with overview of forums (2017-04-29)
Here's a live video basically talking about the forums and code optimizations mainly.. I'm really just testing video recording on a different machine with a head set mic etc.. sadly the results are pretty sucky, but content is ok so here it is
Welcome... This video isn't a tutorial, but the introduction to our learn PlayBasic programming series for beginners. These videos take new user through some of the fundamentals of BASIC programming. Which is all the boring the stuff you need to learn, in order to make anything fun. We know it's not easy so our advice is to use these videos / help files and forums together. Don't just watch the videos, but sit down try to code something using the ideas. It might seem hard initially, but you will get it ! And most importantly have some fun