[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. |
[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... |
By all means, go ahead and use BB2, just don't try to adapt PC source codes in it.
|
Quote:
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. |
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?
|
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?
|
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. |
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() then for instructions like cls, setOrigin etc. are already on blitz 2 or need to use other ones? |
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..
|
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? |
Quote:
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) Code:
NextPiece = RND(6)+1 Quote:
Code:
Function RotatePiece(rotateLeft = False) Code:
Statement RotatePiece{rotateLeft} Note: there is a Code:
If .... Then Return You can (for now) just replace the Return with Code:
Statement Return Quote:
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. |
@Cylon
sounds like homework ^^ |
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 Code:
Global CurPieceX = 3 Code:
Function Foo {} *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....:) |
did not had time to work on it this weekend, will keep you posted
|
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 |
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). |
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)
|
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... |
Quote:
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 Code:
Origin OrigBoardX, OrigBoardY Code:
!Origin {OrigBoardX, OrigBoardY} Code:
Line 0, 200, 400, 200, ... Code:
Line xx+ 0,yy+ 200,xx+ 400,yy+ 200, ... That way we get our Origin. It also only happens a few times, so it is not much work. |
Quote:
Example: Code:
If NOT DropPiece{} 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{} |
All times are GMT +2. The time now is 09:42. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.