News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

new guy here

Started by sicko, March 31, 2005, 10:38:17 PM

Previous topic - Next topic

sicko

helo every one, im really glad i found this site; i been searching for something like this for a longtime; well;

i have some limited programing experience but it really stops at (your all gonna laugh) programming really bad games on my commodore 64;... anyway; i am totally lost as to where to begin with Playbasic.. i know it is pretty self explanitory, but this is quite a bit different then the basic i am acustomed to...(ahhh how simple was 1988 anyway?) well, anyway; any suggestions or ideas would help me greatly...

Im really not trying to do anything rediculously complex; as i am inspired by games like the old nes Castlevania, metroid, contra etc...side scrollers really...

well thanx for reading and any support you might be able to offer

kevin

Welcome Sicko,

So your familiar with C64 basic mostly ?   yeah things have changed a lot since then.

 I guess some big differences are things like line numbers are the thing of the past and now most stuff is presented for you, without you  have to hit the hardware to make it do anything. (ie poke the sprites/ video registers/screen to do anything)


Most of the core BASIC language is the same as other basics

for lp=0 to 10
  print "hello"
next lp

; display the screen
Sync
Waitkey

Thee's also  WHILE/ENDWHILE   Repeat/UNTIL    iF/THEN   IF/ELSE/ENDIF


 GOTO and GOSUB are still around, but rather than a line number we use a LABEL now.



 Goto STARTHERE

  Print "This like is skipped"

StartHERE:
 
  Print "Hello"

  Sync
  waitkey

sicko

Thank you vey much for the input there; it definetly cleared a bit up; wellim gonna get a jump on this and make it start happening; im sure ill be back numerous times;

kevin

Well, the forums are place to learn, share, exchange info.  Feel free to ask questions, chit chat..  add ideas.. etc

sicko

very cool; i am definetly glad to have stumbled upon this forum;  well, i guess the first place i need to start is creating a character sprite...for a test run anyway...

I have been looking to the platform demo as a reference, tho i am still a little lost on how to create a smoothly animated character... what would you reccomend ?

kevin

To make animations you'll need to load, or grab the frames of your characters into PB as images.

i.e.

 LoadImage "Frame1.bmp",1
 LoadImage "Frame2.bmp",2
 LoadImage "Frame3.bmp",3

Once each frame is in memory, you can manually draw these images to the screen .  Using the DrawImage command.


 So to draw image #1 (frame 1) at Xpos 100, Ypos 200,  with no transparent pixel.  Would be

 DrawImage  1,100,200,0





Animation currently controlled  by the user.  So to make an example that draws each frame to screen, we could use some code like this.




; Load your characters animation frames into memory
  LoadImage "Frame1.bmp",1
  LoadImage "Frame2.bmp",2
  LoadImage "Frame3.bmp",3

; Create a variable to hold the Current IMage of our animation sequence
  CurrentImage =1


; Start DO/Loop
Do

; Draw the currentimage to the screen at 100x,200y, as render as solid (no transparent pixels).    
  Draw CurrentImage,100,200,0

; Change the Anim  frame.
; Since our images were loaded in sequence, if we bump  the CurrentIMage counter by 1 each loop,  then each loop, it'll draw the next fraem in the sequence.

 CurrentImage= CurrentImage+1


; Check if CurrentImage is higher than 3 (our last loaded frame), if so, reset it to 1..
   
  If CurrentImage>3 then CurrentImage=1



;  Display the Screen to the user.
 Sync

;  loop back to the DO statement
loop




 Note: This example doesn't take into account the speed of the computer running it though.  So we could Slow it down by adding a SetFps command to limit the max number of 'Syncs" (Screen displays) available each second.

 Ok, i'll let you chew on that a moment, as the obvious next question, may well be how do we animated many images, and different speeds ..