PlayBasic TUTORIALS


     New to programming and need some help getting started ? - Well, then our tutorial section will help kick start your programming adventure. If you're looking for more Source Code / Tutorials & Media ? - Then remember to visit the PlayBasic Resource board on our forums.

Found #19 items in Beginner category


 PlayBasic Tutorial: Intro To Functions

By: Kevin Picone Added: July 7th, 2018

Category: All,Video,Beginner,Functions,Variables,Scope,Getting Started, Intermediate

     Hi welcome to our Intro to PlayBasic 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..






Get Source Code Example For This Tutorial




 PlayBasic Tutorial: From Arrays To Types (Intro To Types)

By: Kevin Picone Added: June 14th, 2018

Category: All,Video,Beginner,Types,List,Arrays,Variables,Getting Started,Learn To Code

    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.



Links:

    * PlayBasic Tutorial: From Arrays To Types (Intro To Types) Source Code





 PlayBasic Tutorial: Saving a New Project ( IDE BASICS )

By: Kevin Picone Added: April 15th, 2018

Category: All,I.D.E,Tutorial,Beginner,Getting Started,Source Code,Learn To Code

    This video takes the new PlayBasic programmer through a couple of examples that demo how to save a new project and create a new project folder using the PlayBasic IDE (Source Code editor) -

    1) In example one we write th classic Hello World example and then show how to save it as a project to the desktop

    2) In the second example we take this further by adding some sprite media to the project manually then demo how you might load the sprites and display them.





 PlayBasic Tutorial: From Variables To Arrays

By: Kevin Picone Added: September 20th, 2017

Category: All,Video,Beginner,Arrays,Variables,Getting Started,Learn To Code

    Welcome PlayBasic 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



Example #1 Variables

PlayBasic Code:
  Xpos1  = 400
   Ypos1  = 300
      
   Xpos2  = 100
   Ypos2  = 100

      
   setfps 20   
      
  do    

    cls rgb(10,20,40)

   ; Draw circle 1        
     Circle Xpos1,Ypos1, 32, true
   
     Xpos1 = Xpos1 + 2
     Ypos1 = Ypos1 - 4
  
      Xpos1 = WrapValue(Xpos1,0,800)     
       Ypos1 = WrapValue(Ypos1,0,600)     
   
   

   ; Draw circle 2      
     Circle Xpos2,Ypos2, 64, true
   
     Xpos2 = Xpos2 + 2
     Ypos2 = Ypos2 + 2
       Xpos2 = WrapValue(Xpos2,0,800)     
       Ypos2 = WrapValue(Ypos2,0,600)     
  
     sync
  loop
  
 
COMMANDS USED: SETFPS | CLS | RGB | CIRCLE | WRAPVALUE | SYNC |




Example #2 Array Version

PlayBasic Code:
 Setfps 20

   Number_Of_Characters = 50 

   dim Xpos( Number_Of_Characters  )
   dim Ypos( Number_Of_Characters  )
   dim size( Number_Of_Characters  )
   dim Xspeed( Number_Of_Characters )
   dim Yspeed( Number_Of_Characters )
   dim Colour( Number_Of_Characters )
   
   
   for lp = 1 to Number_Of_Characters
         Xpos(lp)  = rnd(800)
         Ypos(lp)  = rnd(600)
         Size(lp)  = rndrange(16,50)
         Xspeed(lp) = rndrange(-5, 5)
       Yspeed(lp) = rndrange(-5,5)
       Colour(lp) = rndrgb()
   next
   
   
  do 
     
        Cls rgb(0,400,20)
        
        for lp=1 to Number_Of_Characters
           
           Radius = Size(lp)

           circlec xpos(lp),ypos(lp),Radius,true,Colour(lp)
           
         //  xpos(lp) = Xpos(lp) + Xspeed(lp)
         //  ypos(lp) = ypos(lp) + Yspeed(lp)
           
           xpos(lp) = wrapvalue(xpos(lp) + Xspeed(lp) , -Radius, 800 + Radius)
           ypos(lp) = wrapvalue(ypos(lp) + Yspeed(lp) , -Radius, 600 + Radius)
                      
        next
          
        Sync
     loop


COMMANDS USED: SETFPS | DIM | RND | RNDRANGE | RNDRGB | CLS | RGB | CIRCLEC | WRAPVALUE | SYNC |






 PlayBasic Tutorial: Intro to GOTO & GOSUB statements

By: Kevin Picone Added: April 8th, 2017

Category: All,Video,Beginner

     Welcome, in this tutorial we take a look at some none conditional control change statements, or otherwise known as Goto and Gosub statements in PlayBasic.



    Commands used in this tutorial. Goto / Gosub / Return / For / Next / If / EndIf / Mousex() / MouseY() / MouseButton() / Print / Circle / Sync and possibly a few others.





 PlayBasic Tutorial: Into to IF / Then and IF / ENDIF statements

By: Kevin Picone Added: March 21st, 2017

Category: All,Comparisons,If,Learn To Code,Beginner

PlayBasic Tutorial: Into to IF / Then and IF / ENDIF statements ( 2017/03/21)

    This #tutorial walks the new coder through the IF / THEN and IF / ENDIF statement pairs which are used to selectively execute sections of the code, based upon the result of the comparison operators. IF statements actually allow changes in execution control, so they act upon the comparison, but it's just easier to think of them as part of the comparisons landscape when learning programming.

#coding #learntocode #programming #basic #makegames #howto #programmer #code



PlayBasic Code:
	Setfps 20

	Do
		Cls rgb(20,30,40)

		;
		Mx = MouseX()
		My = MouseY()

		Circle Mx,My,40,true

		print Mx
		print My


		box 500,300,600,400,false

		if (Mx > 500) and  (Mx < 600) and  My >300 and My<400
						print "Mouse is within zone"
		endif

		Sync
	loop


COMMANDS USED: SETFPS | CLS | RGB | MOUSEX | MOUSEY | CIRCLE | PRINT | BOX | AND | SYNC |






 PlayBasic Tutorial: Intro To FOR NEXT LOOPS

By: Kevin Picone Added: March 20th, 2017

Category: All,Video,Beginner,Getting Started,Variables,Loops

    This tutorial takes the new basic coder through the bare bones of the FOR / NEXT loop. The tutorial was recorded live and is uploaded virtually as is, warts and all. In this tutorial we use loops to draw simple graphical objects such as boxes moving through to making a grid of scrolling boxes.

     Commands used in this tutorial. For / Next / Step / Exit / Continue / Print / Line / Box / Sync / Ink / RGB() / RND() / RndRGB() and possibly a few others.








 PlayBasic TUTORIAL: Getting Started with the PlayBasic IDE

By: Kevin Picone Added: February 24th, 2017

Category: All,I.D.E,Video,Beginner,Getting Started

PlayBasic TUTORIAL: Getting Started with the PlayBasic IDE

Welcome, this tutorials takes the new programmer around the PlayBasic IDE. Focusing mainly the moving around the help files and some basic IDE usage.







Viewing Page [1] of [3]





Looking for More Tutorials?:



 

 
     
 
       

(c) Copyright 2002 / 2024 Kevin Picone , UnderwareDesign.com  - Privacy Policy   Site: V0.99a [Alpha]