Home Page Downloads Order Community Support
 

 

 
 

 

 

 

 
 

News Articles


    What's News in the PlayBasic world ? - Find out here.




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

By: Kevin Picone Added: 4 days ago

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

Want to learn 2D game programming ?


Video:



Example #1 - Variables Example

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
  
 



Example #2 - Arrays Example - Using Parallel Arrays To Store Character Properties
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

Link     




 PlayBasic (retro) Video Gallery

By: Kevin Picone Added: July 22nd, 2017

     PlayBasic (retro) Video Gallery

     Hi, just wanted to let you know that we've been creating lots of videos of some the older PlayBasic game / demo projects from over the years. Check em out on the forums.

     Watch PlayBasic (retro) Video Gallery

Link     




 PlayBasic V1.65B _Retail Upgrade_ Now Available (23rd, June, 2017)

By: Kevin Picone Added: June 23rd, 2017





PlayBasic V1.65B _Retail Upgrade_ Now Available (23rd, June, 2017)



     The PlayBasic V1.65B package includes updates of PlayBasic Compiler, Release / Debug Runtimes, SLIBS, DOCS & IDE V1.17b.

     The V1.65B includes the second release of the next generation of the PlayBasic virtual machine. In this build 99.99% of the commands now executed upon the new VM side, giving much higher execution performance. There are still some 'commands' tied to the legacy VM such as the debugger commands and few text commands such as Print and TEXT and the Sync command which is actually a VM TRIGGER, but they'll be moved in the next build..

     Performance wise this is easily the fastest edition of PlayBasic to date, even though the runtime is missing some of the byte code optimization modes found in V1.64 builds, which will tackled in the next revision of the 1.65, but for now get stuck into it.

     Reminder: The new runtime doesn't support reading from types that don't exist, which can cause old programs to fail at runtme. For a full V1.65B development story read the PlayBasic V1.65 blogs and for V1.65 related errors, post them in the V1.65 bug reporting thread on the forums.


Downloads


     Download PlayBasic V1.65B Retail Upgrades From Forum

Link     




 PlayBasic Live: 2D Optimization Tips (2 videos)

By: Kevin Picone Added: June 20th, 2017

PlayBasic Live: 2D Optimization Tips - Dirty Rects (2017-06-19)

     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



Link     




 PlayBasic LIVE - Intro to G2d (openGL for PlayBasic)

By: Kevin Picone Added: May 9th, 2017

PlayBasic LIVE: Intro to G2D (openGL library for PlayBasic) 2017-05-07

Link     




 PlayBasic LIVE: Basic Optimization with overview of forums

By: Kevin Picone Added: April 30th, 2017

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

(NOTE: LOW AUDIO ) Watch On YouTube
Link     




 PlayBasic Tutorial: Learn BASIC Programming Tutorial Introduction

By: Kevin Picone Added: April 26th, 2017

PlayBasic Tutorial: Learn BASIC Programming Tutorial Introduction

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





Watch Learn PlayBasic programming Tutorial Play list on youtube!


Link     




 PlayBasic Tutorial: Intro to GOTO & GOSUB statements

By: Kevin Picone Added: April 16th, 2017

PlayBasic Tutorial: Intro to GOTO & GOSUB statements

     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.


Watch On YouTube
Link     




Viewing Page [1] of [26]

Back - Next

 

 
     
 
       

 

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