14 January 2018, 09:29 | #61 |
Registered User
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
|
Thanks!
Now it is not magic anymore |
16 January 2018, 18:38 | #62 |
Registered User
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
|
Hello
Two basic questions: 1. is it possible to pass a list to a function as an argument? 2. is it possible to declare a list within a function? When I try to do this inside the function i get error "ARRAY IS NOT A LIST": Code:
NEWTYPE.myType a.b b c End NEWTYPE Dim List lista.myType(100) If AddItem(lista()) Then lista()\a=1 ;here the error shows up Thanks. EDIT 3.What is going on here: Code:
NEWTYPE.bspArea c.b r w h End NEWTYPE Statement test{c,r,w,h} nPrint c," ",r," ",w," ",h ;DEFTYPE.bspArea panel ;<- when i uncomment this line strange results are showing End Statement test{0,0,10,10} MouseWait End with DEFTYPE: 0 0 10.9997 10 Last edited by peceha; 16 January 2018 at 21:39. |
16 January 2018, 22:54 | #63 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
1: Not that I know of. You can use the Shared keyword to allow the procedure to access the same list as the main program. Newtypes can be passed as a pointer, but I don't think lists can be assigned to pointers so I don't think passing a list is possible. Maybe someone else knows a way though?
2: No, only indexed arrays can be declared within a function. As before however, you can use a global list with the Shared keyword, so long as you remember to clear it each time and don't do any recursion. 3: Hmmm, looks like a bug. What version of Blitz are you using? I vaguely remember in the AmiBlitz changenotes that there was a fix for some bug in parameter passing that you may have stumbled upon. It looks like a mismatch of types that's not getting picked up by the compiler / debugger. I would suggest always declaring types for parameters like that, and that should avoid the problem: Statement test{c.b, r.b, w.b, h.b} |
16 January 2018, 23:07 | #64 |
Registered User
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
|
ad.3
Im using BB2 release 2.1, TED v2.24 When I replace Statement test{c,r,w,h,} with: ..{c.b, r.b, w.b, h.b} then i have 0 0 -8 10 ..{c.w, r.w, w.w, h.w} then i have 0 0 -12 10 ..{c.l, r.l, w.l, h.l} then i have 0 0 65516 10 |
17 January 2018, 09:44 | #65 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Hmmm, that's very weird. There appears to be an extra byte or something assigned to the 3rd parameter. I would use a later version of Blitz 2 fro a start, see if that fixes the problem. The Ultimate Blitz Basic CD has a later version, and other updates are available from Blitz-2000.co.uk.
|
17 January 2018, 09:54 | #66 | |
Registered User
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
|
Thanks for help.
You were right about a bug: Quote:
Thank you. |
|
18 January 2018, 23:10 | #67 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
If there an equivalent of If ... Else If ... Else?
I've tried "Else If" "Elseif" and "Elsif" but it doesn't like any of them. There must be a way, surely? |
19 January 2018, 11:42 | #68 |
Registered User
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
|
Hi,
how does QUALIFIER work? I typed the script from manual but it doesnt work for me: Code:
... While (Qualifier AND $8)=0 ... Wend ... |
19 January 2018, 21:18 | #69 |
Registered User
Join Date: Dec 2015
Location: Lisbon/Portugal
Posts: 51
|
|
19 January 2018, 21:33 | #70 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
Also; how does one get dual playfields to work? I just can't seem to get the background to display. I guess it's a palette issue, but I'm not sure which colour to set.
To make matters more complicated (because an easy life isn't for me), I want to have an 8-coloured background and a 4-coloured foreground. The hardware should support this, but does Blitz? I'd rather not have 8-colours in my foreground as I want to minimize the amount of blitting. http://amigadev.elowar.com/read/ADCD.../node0079.html Is the secret to have 8 bitplanes in both fields but only blit the planes I actually want, using something like BitPlanesBitMap? I realise that I may be running before I can walk... but I thought it should be relatively straightforward to have one box moving in front of the other... |
19 January 2018, 21:40 | #71 | |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
Quote:
Code:
if (test1){ do_thing_1 } else if (test2){ do_thing_2 } else{ do_default_thing } A concrete exampe; I'm bouncing a box around a screen, and I want to bounce it off the edges of the screen. So, I test for the 4 extremities. However, if the box hits one edge I needn't bother testing the opposite one, as it can't possibly hit both. Last edited by E-Penguin; 19 January 2018 at 21:46. |
|
20 January 2018, 07:52 | #72 |
Registered User
Join Date: Oct 2008
Location: Finland
Posts: 643
|
|
20 January 2018, 12:26 | #73 |
Registered User
Join Date: Dec 2015
Location: Lisbon/Portugal
Posts: 51
|
Regarding the playfield and bitplanes take a look at page 80
https://archive.org/details/blitz-basic-2-user-guide I think this applies to slices but the last version of Blitz 2.1 can do more with AGA and copperlist if I'm not mistaken, because I'm noob too |
21 January 2018, 19:01 | #74 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Yep, witchmaster is correct, there's on ElseIf. Nesting the following If/Then in the Else portion as he suggested is about as close as you can get.
As for the dual playfields, both playfields should be treated as separate displays, so use colours 0-7 for the graphics in both (assuming 3+3 bit depths). These are used directly for the front playfield, and the rear playfield pens are remapped to pens 8-15. So pen 3 on a bitmap will be shown as colour 3 in the palette on the front playfield, but colour 11 on the rear playfield. If you don't set colours 8-15 in the palette or only allocated 8 colours when you set up the display, they default to black so that could explain why you're not seeing your graphics. This applies to both slices and Display Library displays, though I recommend using the Display Library as it's more powerful and flexible, and supports AGA. As for splitting the display like that, the hardware does indeed support it but Blitz does not - displays can only be set up with the same number of bitplanes on both playfields. Blitting 3 bitplanes is pretty fast though so I would suggest just going with that until you discover you really need more blitter time. If that does turn out to be the case, you're on the right track - the BitplanesBitmap command allows you to blit fewer planes than the bitmap contains by using an intermediate dummy bitmap. |
21 January 2018, 19:40 | #75 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
That should just quit pressing any key with Control held down. Qualifier is a function that returns a code telling you which qualifier key was pressed when the last keypress Intuition event was triggered. Bear in mind however that you need to be collecting Intuition events for that to work, so you should have either Event or WaitEvent within the While loop.
|
21 January 2018, 20:10 | #76 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
If…Else...ElseIf…Else constructs lead to the "dangling else" problem ( https://en.wikipedia.org/wiki/Dangling_else ), so it's understandable that the Acid guys avoided that in Blitz.
Most cases of ElseIf are usually just a more complex way of writing Select…Case…Case…End Select. |
21 January 2018, 21:42 | #77 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
Thanks all. I'll have another go at the dual playfield then and just blit the ones I need.
idrougge, I thought about replacing it with a select/case. In the end a nested if block did the trick. My intended game is to be an Asteroids clone, and naively I created a bunch of x, y pairs in some newtypes, which I translate and draw with Poly onto a bitmap each frame. Just bouncing around the screen not doing much, I can get about 20 on my a1200 + b1230, but barely 6 on a stock A500. Am I relying too much on the processor? My Plan B is to draw to a bitmap, cut out shapes and then QBlit those, but, surely, the 2d drawing functions should be able to handle more than 6 polygons? Any 3d game must be doing more than that, and I'm not dealing with a z-axis at all. |
22 January 2018, 15:27 | #78 |
Registered User
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
|
Thanks Daedalus.
Now I think I have e quick one Code:
var.q=2.9 fr.b = Frac(var)*10 print fr Shouldn't be 9? |
22 January 2018, 17:30 | #79 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
what if you change it to fr.q? I wonder if it is truncating too soon.
|
22 January 2018, 17:43 | #80 |
Registered User
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
|
I changed the type to [quick] and the result is: 8.9999
It means: 0.9 * 10 = 8.9999 and since type [byte] cuts everything after coma I get 8. Looks like I need to be more careful when it comes to [quick] type. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Blitz basic 2 Help | Havie | Coders. Blitz Basic | 30 | 08 September 2013 09:15 |
blitz basic | petza | request.Apps | 11 | 08 April 2007 01:49 |
Blitz Basic 2 anyone? | jobro | request.Apps | 12 | 28 November 2005 18:15 |
Blitz Basic StopCD32 | Tony Landais | Coders. General | 2 | 08 May 2003 22:51 |
Blitz Basic 2 | LaundroMat | Retrogaming General Discussion | 5 | 24 July 2001 08:10 |
|
|