English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 10 February 2015, 20:46   #1
saimon69
J.M.D - Bedroom Musician
 
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,516
[blitz basic] How much amiga-blitz friendly is this?

[note: i just got all pieces of amiblitz 2 and going to install it so am not ready yet]

found this tutorial for a Tetris clone on blitz basic PC: how much do i need to modify this to make it run on an amiga? (of course the 800x600 screen gotta go)

bare-bones tetris clone example code

Seems kinda straightforward but since is a long time i dont touch a basic and havent touched Blitz yet i want to make sure before to start work on it.

Last edited by saimon69; 10 February 2015 at 20:46. Reason: typos
saimon69 is offline  
Old 11 February 2015, 18:54   #2
saimon69
J.M.D - Bedroom Musician
 
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,516
[update]
ok, actually what i found is Blitz Basic 2: is the one to use or what version do you advice me? i remember hearing about using Amiblitz 2 rather than 3...
saimon69 is offline  
Old 11 February 2015, 22:04   #3
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
By all means, go ahead and use BB2, just don't try to adapt PC source codes in it.
idrougge is offline  
Old 11 February 2015, 23:38   #4
Coagulus
Gets there in the end...
 
Coagulus's Avatar
 
Join Date: Sep 2005
Location: Wales
Posts: 862
Quote:
Originally Posted by idrougge View Post
By all means, go ahead and use BB2, just don't try to adapt PC source codes in it.
It's possible (sort of) from PC Blitz to Amiga Blitz, I've done it with Timebomb and I'm doing it with JetHunt.

But be prepared to do a fair bit of rewriting, especially where anything writes to the screen.

And I replaced many of the functions eg drawboard() with labels eg .drawboard and used Gosub to call them but you then have to rearrange the variables especially if functions are using local variables. Blitz amiga does have statements and functions though too.
Coagulus is offline  
Old 12 February 2015, 03:05   #5
saimon69
J.M.D - Bedroom Musician
 
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,516
Else, is there some tetris game written in BB2 amiga that i can take as reference to understand how to modify it to my needs?
saimon69 is offline  
Old 12 February 2015, 23:25   #6
Cylon
Registered User
 
Join Date: Oct 2014
Location: Europe
Posts: 470
I've written one couple of years ago, but the src is not public. What you need is: Look how tetris works and figure out how to do this by yourself. It is fairly simple. Why do you need the source "to modify it to [your] needs" instead of writing it all from scratch?
Cylon is offline  
Old 13 February 2015, 01:02   #7
saimon69
J.M.D - Bedroom Musician
 
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,516
first because i dont know where to get my hands on to modify that source code: i guess the logic of handling arrays and collision is basically the same but display have no clue: i code in javascript actionscrtipt 1 and php and used zx basic but blitz is definitely different: did look for tutorials very base level but found little stuff so far

second, because my fnal purpose is to create a version of the old flashpoint arcade, that is based on tetris logic plus some little additions (now is more a beat the level game than a puzzle one) so having a working tetris base i could just add modifications - did it on a tetris flash so more or less i know what to add but lack basics to do it on blitz.
saimon69 is offline  
Old 17 February 2015, 22:28   #8
saimon69
J.M.D - Bedroom Musician
 
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,516
ok i got rid of a biltz2 copy and started to get grip of the usage. So far i changed the set screen and the key control but now have some doubts about some functions and instructions used on that port.

First of all: are the read-data instructions used in the same way?
second the instruction
Code:
SeedRnd MilliSecs()
is correct or have to use other stuff?

then for instructions like cls, setOrigin etc. are already on blitz 2 or need to use other ones?
saimon69 is offline  
Old 19 February 2015, 10:35   #9
saimon69
J.M.D - Bedroom Musician
 
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,516
Updates: i was able to make the BlitzOut AF tutorial run; had to write a separate program to generate the shapes though; this also made me understand that have a good deal of work to do in order to convert that tutorial in Amiblitz; will go on slowly and steadily..
saimon69 is offline  
Old 19 February 2015, 21:34   #10
saimon69
J.M.D - Bedroom Musician
 
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,516
ok so was pondering on what to do and i realized am using not the listing above but the more advanced one here:
tetris clone example code

now i started to convert some of those functions in statements however some of the functions actually have parameter, like RotatePiece; how transfer parameters on a statement?

Plus, am planning to use shapes and not drawn blocks: how much the logic might differ?
saimon69 is offline  
Old 19 February 2015, 22:21   #11
Cylon
Registered User
 
Join Date: Oct 2014
Location: Europe
Posts: 470
Quote:
Originally Posted by saimon69 View Post
First of all: are the read-data instructions used in the same way?
second the instruction
Code:
SeedRnd MilliSecs()
is correct or have to use other stuff?

then for instructions like cls, setOrigin etc. are already on blitz 2 or need to use other ones?
Yes, the read-Data is basic BASIC. Please note: Blockcolor is in 24bits (255 values for red/green/blue). So you need AGA display or RTG.

Forget SeedRnd, you don't need it. This is for internal use of the random number generator. Just replace the
Code:
NextPiece = Rand(1, 7)
with
Code:
NextPiece = RND(6)+1
and you are good.

Quote:
Originally Posted by saimon69 View Post
..now i started to convert some of those functions in statements however some of the functions actually have parameter, like RotatePiece; how transfer parameters on a statement?
Code:
Function RotatePiece(rotateLeft = False)
could be just
Code:
Statement RotatePiece{rotateLeft}
Note the brackets. You cannot declare anything of the arguments inside the function arguments. And: Any variable listed as GLOBAL variable on top of the source present in your Function or Statement must be declared inside the Function with SHARED before using it. Otherwise it is 0.
Note: there is a
Code:
  If .... Then Return
inside this Function.
You can (for now) just replace the Return with
Code:
Statement Return
(Normally, you have to "Pop" too. Doesn't matter now.
Quote:
Plus, am planning to use shapes and not drawn blocks: how much the logic might differ?
You can draw the blocks to create your own shapes once and save/load them later. Or you use a paint program. Or you start to use the block drawing and change that later. But this is headache, donot start with this. Try to make it run first, let it compile and see what happens.
Reason: You have to change the logic quite a bit. I would start to replace the little "DrawBlk" Function with a simple "Box", with adaptions for color, of course. this would speed up things a little bit if you after this.

Last edited by Cylon; 28 February 2015 at 02:33. Reason: typos, misspellings and so on..
Cylon is offline  
Old 19 February 2015, 22:59   #12
saimon69
J.M.D - Bedroom Musician
 
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,516
@Cylon

sounds like homework ^^
saimon69 is offline  
Old 20 February 2015, 23:27   #13
Cylon
Registered User
 
Join Date: Oct 2014
Location: Europe
Posts: 470
No, not really. If you know Blitz a little bit then a little thinking gets you further.
* Don't use the RGB at all. Use Colors (one for each of the 7 tiles).
* Put all the Functions (or Statements after "conversion") on top, right after init and variable declaration. The main routine follows (because you can only call Functions after they have been created).
* If you don't want to screw up too much of the original src, you can go for a screen with the same dimensions, maybe with less colors (8 bit or less). Just make it autoscroll 800x600, the displays dimensions doesn't matter in that case.
* Replace all GLOBAL on top with SHARED (Find&Replace), then encapsulate the whole GLOBALSHARED block with
Code:
Macro myshared
SHARED Endofgame  ;example!
.
.
End Macro
Every declaration, e.g. Global CurPieceX = 3 must go:
Code:
Global CurPieceX = 3
becomes
SHARED CurPieceX

and later (or before, as we encapsulated the Globals into a macro)
CurPieceX = 3
Now, in every function Foo we write the macro call on top
Code:
Function Foo {}
!myshared
.
.
End Function
Which should work just fine.

*Edit:
Please note: You have DIMed some arrays, those Shares must be inside the myshared Macro too.

The provided source is actually quite easy to convert to Blitzbasic2....

Last edited by Cylon; 25 February 2015 at 23:07. Reason: changes ?!?
Cylon is offline  
Old 24 February 2015, 01:40   #14
saimon69
J.M.D - Bedroom Musician
 
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,516
did not had time to work on it this weekend, will keep you posted
saimon69 is offline  
Old 24 February 2015, 08:08   #15
saimon69
J.M.D - Bedroom Musician
 
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,516
ok continued to work on the adaptation, now have a "garbage at end of line" error when the code reach an Origin statement like:

Code:
Origin OrigBoardX, OrigBoardY
saimon69 is offline  
Old 25 February 2015, 22:47   #16
Cylon
Registered User
 
Join Date: Oct 2014
Location: Europe
Posts: 470
Ignore that ;-)
It means: "Origin" is not a known Command or whatever, if it is a label, then there is cr*p after it.

It sets the origin coordinates for the following text statements. Add a ; in front of this line. Proceed adding ; in front of every text .... you encounter on the way. Dito with color ...

As i said: Make it compile. Save all (big) steps into different file iterations.

I've got mine compiling, btw. (started today 1:30 hrs ago).

Last edited by Cylon; 25 February 2015 at 22:56. Reason: adds
Cylon is offline  
Old 26 February 2015, 00:58   #17
saimon69
J.M.D - Bedroom Musician
 
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,516
Well you got more experience, i feel like trying to make my horizons tape running on ZX spectrum for the first time (and it took a good while - talking on a week of attempts - due to volume and azimut settings)
saimon69 is offline  
Old 26 February 2015, 10:48   #18
saimon69
J.M.D - Bedroom Musician
 
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,516
so now here i am with a Illegal Procedure Call concerning DrawBlk:

following the above syntax i modified it as DrawBlk{params} because with round braces was having syntax error...
saimon69 is offline  
Old 26 February 2015, 21:54   #19
Cylon
Registered User
 
Join Date: Oct 2014
Location: Europe
Posts: 470
Quote:
Originally Posted by Cylon View Post
Ignore that ;-)
It means: "Origin" is not a known Command or whatever, if it is a label, then there is cr*p after it.

It sets the origin coordinates for the following text statements. Add a ; in front of this line. Proceed adding ; in front of every text .... you encounter on the way. Dito with color ...
.
It is not like that after looking at it again today.
All the Origin.... variables setting different areas which act as an origin(!) to the following drawing commands.
I can surround this (as Blitz2 has no Origin cmd) by creating a Macro:
Code:
Macro Origin
  xx=`1
  yy=`2
End Macro
In the statements, we replace the
Code:
Origin OrigBoardX, OrigBoardY
with
Code:
!Origin {OrigBoardX, OrigBoardY}
and all calls to drawing operations, like LINE, are using the xx and yy we created using the Macro:
Code:
Line 0, 200, 400, 200, ...
Code:
Line xx+ 0,yy+  200,xx+ 400,yy+ 200, ...
And so on.
That way we get our Origin. It also only happens a few times, so it is not much work.
Cylon is offline  
Old 26 February 2015, 22:06   #20
Cylon
Registered User
 
Join Date: Oct 2014
Location: Europe
Posts: 470
Quote:
Originally Posted by saimon69 View Post
so now here i am with a Illegal Procedure Call concerning DrawBlk:

following the above syntax i modified it as DrawBlk{params} because with round braces was having syntax error...
"Illegal Procedure Call" happens, when you try to call a Function as a Statement or vice versa.

Example:
Code:
If NOT DropPiece{}
indicates it is a Function, because it returns a value, so we can check it with
If NOT (return from)DropPiece{}.

EDIT: (return from) indicates a spark in your mind, as a NOT expects an argument that is kindly delivered as a return value from a Function{}

Last edited by Cylon; 18 April 2015 at 01:52. Reason: Try to teach something and avoid further misunderstandings
Cylon is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorials for Amiga Blitz Basic 2? Kenan support.Other 2 19 July 2013 23:27
amiga and old blitz basic prog - please help brian hills support.Other 7 05 October 2009 01:56
Wanting to learn Blitz Basic on real Amiga Adropac2 request.Other 20 20 August 2008 07:30
blitz basic petza request.Apps 11 08 April 2007 01:49
Blitz Basic 2 LaundroMat Retrogaming General Discussion 5 24 July 2001 08:10

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 13:22.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10278 seconds with 14 queries