19 March 2015, 09:21 | #41 |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,606
|
Well i see colors, i see some text, i DONT see the blocks yet... going on...
|
20 March 2015, 06:36 | #42 |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,606
|
Now first i found was hawing two screens (my fault)then the grid appear but is kinda skewed so i really need to update stuff
|
20 March 2015, 07:08 | #43 |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,606
|
update: actual situation with no blocks and a error concerning Piece() as Array subscript out of range
|
22 March 2015, 00:47 | #44 | |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 479
|
Quote:
Thats a tricky one for a beginner, not easy to solve. Let's have a look at it: Code:
pieceToCheck = CurrentPiece + (((CurPieceRot + 1) * (CurPieceRot < 3)) * 7) Code:
(CurPieceRot < 3) Well, it gives you a boolean answer for: Is CurPieceRot less than 3 (or is it not). The answer is given as TRUE or FALSE, while TRUE (in Blitzbasic Amiga) means -1 (!), FALSE means 0. If the result is indeed True, it becomes -1 multiplied with 7 and some, ending up as -7, causing sometimes the array limits being underrun. Solution: Make the result absolute! The standard BASIC cmd (function) for this is ABS(), or a little bit quicker in Blitz, QAbs(). Code:
pieceToCheck = CurrentPiece + (((CurPieceRot + 1) * QAbs(CurPieceRot < 3)) * 7) btw., milliseconds() can be replaced with Ticks. Ticks is from elmorehw.lib. If this is not shown in your Blitzted as a highlighted command the solution is probably not beginnerfriendly anymore i'm afraid. Last edited by Cylon; 22 March 2015 at 01:47. |
|
24 March 2015, 08:58 | #45 |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,606
|
hmm have no PieceToCheck variable - er correction i found it but still have the error
Last edited by saimon69; 25 March 2015 at 07:17. |
28 March 2015, 00:19 | #46 |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 479
|
This is the RotatePiece{} function it should look like:
Code:
Statement RotatePiece{rotateLeft} !myshared ;Local pieceToCheck If rotateLeft pieceToCheck = CurrentPiece + (((CurPieceRot - 1) + 4 * QAbs(CurPieceRot < 1)) * 7) Else pieceToCheck = CurrentPiece + (((CurPieceRot + 1) * QAbs(CurPieceRot < 3)) * 7) EndIf For yiter = 0 To 3 For xiter = 0 To 3 If Piece(pieceToCheck, xiter, yiter) <> 0 If ((CurPieceX+xiter) < 0) OR ((CurPieceX+xiter) > 9) OR ((CurPieceY+yiter) > 22) Then Statement Return If Board(CurPieceX+xiter, CurPieceY+yiter) <> 0 Then Statement Return EndIf Next Next If rotateLeft CurPieceRot = (CurPieceRot - 1) + 4 * QAbs(CurPieceRot < 1) Else CurPieceRot = (CurPieceRot + 1) * QAbs(CurPieceRot < 3) EndIf CalcGhostPosition{} End Statement |
28 March 2015, 01:13 | #47 | |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 479
|
Quote:
A Statement is a function without a return value. Code:
Statement foo{} ;bla End Statement Code:
Function foo{} ;bla Function Return retvalue End Function Code:
Statement foo{} ;bla if a>x then Statement Return ;more bla End Statement Code:
Function foo{} ;bla if a>x then Function Return retvalue End Function |
|
28 March 2015, 19:42 | #48 |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,606
|
My source is starting to get messy and i am having proble m understand why have a huge flickering no pices on board and everything stops when the (black) piece reach the bottom... source included (no i did not read yours for a stubborn pride to try to figure out on myself)
|
28 March 2015, 22:50 | #49 | |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 479
|
Quote:
Code:
Statement DrawNextPiece{} !sharedstuff !Origin {OrigNextPieceX, OrigNextPieceY} ; r = BlockColor(NextPiece, 0) ; g = BlockColor(NextPiece, 1) ; b = BlockColor(NextPiece, 2) For yiter = 0 To 3 For xiter = 0 To 3 If Piece(NextPiece, xiter, yiter) DrawBlk{col, xx+xiter*25, yy+yiter*25, .25} EndIf Next Next End Statement If you remember, we defined the basic piece colors matching their piece numbers? So, col=NextPiece, or, Code:
DrawBlk{NextPiece, xx+xiter*25, yy+yiter*25, .25} Code:
Statement CheckForLines{} ... ... ... BlockToErase = 5 Points = (NumLines + (NumLines - 1)) + (1 * (NumLines = 4)) ... If Lines < 1 DropSpeed = DropSpeed - 50 + (50 * (DropSpeed < 50)) ... EndIf End Statement These evaluations deliver a possible negative result, so you must add a QAbs in front of them. Code:
Statement DropPiece{} ... If ((CurPieceY+yiter)+1) > 22 Then Statement Return ;False If Board(CurPieceX+xiter, CurPieceY+yiter+1) <> 0 Then Statement Return ;False ... End Statement Code:
Function DropPiece{} If ((CurPieceY+yiter)+1) > 22 Then Function Return False If Board(CurPieceX+xiter, CurPieceY+yiter+1) <> 0 Then Function Return False ... End Function Code:
Statement EndGame{} EndOfGame = True GamePaused = False End Statement Well, there is more (e.g. the Repeat-Forever loop in FindGhostPiece{} and the ProcessInputs{} need attention). Maybe you should actually read something i wrote despite your pride. It will help, believe me. |
|
30 March 2015, 09:23 | #50 |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,606
|
@cylon
actually i did read all you wrote, thought the .lha file included a source code, and did not opened that. so now am here with a couple of IF NOT(return from)DropPiece{} that i have no clue on how to translate, plus the Repeat...forever that have no clue how to modify. The game seems to run, i changed the the references from col to CurPiece and NextPiece but the piece still dont want to appear. |
01 April 2015, 22:54 | #51 | |||
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 479
|
Quote:
It is just the stage i left it in running condition (executable) at that time. Quote:
IF NOT(return from)DropPiece{} is: (think this) to understand what Function{} means; it returns something. Quote:
I did not even try to find the cause of it; did you hit CTRL+ALT+C to break into the debugger? Trace the variables (hit "e" then enter a variable name you can see in src window of debugger). I've changed the condition of this loop from forever to something else (btm of array iirc), i'll tell you later. |
|||
02 April 2015, 01:31 | #52 |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,606
|
Using the Trace command made me receive a Recoverable Alert, is something i have to deal with all the time?
|
04 April 2015, 00:51 | #53 |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 479
|
|
04 April 2015, 02:00 | #54 | |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 479
|
Quote:
You are not in the mood to really pull it off (yet), i believe. Last edited by Cylon; 06 April 2015 at 14:55. Reason: reason? |
|
04 April 2015, 07:55 | #55 |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,606
|
The most complicated program i wrote was involving four ships following the player on ZX spectrum so tetris is a bit different from what i did so far. Include that i can only work one or two hour per night, per one or two nights per week. Am getting hold of the several parts of the language however i feel still have a long way to go, indeed.
|
05 April 2015, 19:48 | #56 |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,606
|
About the Return From - those are things that in javascript or PHP i do all time,like:
Code:
var me = function(){ return you; } if(!me){him} |
09 April 2015, 05:55 | #57 |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,606
|
Changed IF NOT (return from) funcName in IF NOT funcName; now going to try to fix the repeat forever...
Every time i press E i get the recoverable alert so yes there IS something wrong there... ok going on i found that was not drawing the block properly, so now have something in screen but it does not move (due to me commenting CalcGhostPiece maybe but still have no clue on how to set until) Last edited by saimon69; 09 April 2015 at 09:29. Reason: addition |
11 April 2015, 00:36 | #58 | |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 479
|
Quote:
|
|
11 April 2015, 03:16 | #59 |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,606
|
tried both ways same result
|
12 April 2015, 01:04 | #60 |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 479
|
|
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 |
|
|