29 April 2017, 08:00 | #61 |
Registered User
Join Date: Apr 2016
Location: Perth, Australia
Posts: 433
|
Guys I'm wondering how to pass arrays (as pointers) to functions/statements. I have an array that needs to be accessed in a statement without needing to create a new one. I wasn't sure how to do this and my attempts just ended with an error saying the array hadn't been Dimmed although the array works fine outisidr the statement
|
29 April 2017, 10:04 | #62 |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 482
|
You can put a SHARED cmd
inside the Statement, e.g. in the furst line. Code:
Statement foo{} SHARED mydim() ... End Statement Code:
SHARED mydim(), counter.w, *rport.RastPort |
29 April 2017, 21:56 | #63 | |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,908
|
Quote:
Next question - I'm using a dual playfields (don't really have to but experimenting) and my main character is a sprite. it displays fine and the game is running well but I have no idea how to change the sprite colour! I know the sprites using the top 16 colours of the palette but as I am using dualplayfields if I load a bob with more than 8 colours I get a too many bitplanes error and if I try and use RGB to change a colour I get object not used error. I guess there is a command that allows me to define the palette from within BB2 to control sprite colours or am I barking up the wrong tree? Thanks. |
|
30 April 2017, 01:34 | #64 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Yes, the sprites use various colour registers depending on the setup, but that number is "translated" from the sprite shape itself. For example, if you're using colours 240-255, colour 0 of the sprite will be entry 240 on the palette object (but will be transparent so moot...), colour 1 on the sprite will be entry 241 etc.
Note that this is on AGA setups only; OCS/ECS-compatible sprite modes use different, lower registers. |
30 April 2017, 21:45 | #65 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,908
|
Got that. Using only ECS so sprite registers are 16-31 but still having real problems getting the palette to show up. It may be that I am not setting up the screen properly?
Will keep trying - if I can't get it working it may need it's own thread... |
30 April 2017, 23:16 | #66 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,908
|
Made some good progress finally! In the end I have set up a 32 colour screen and saved a 32 colour palette from Dpaint. This works fine for the sprites and the top 16 colours - yeah! On the other hand bobs (which I am putting on the screen via the Block command and then scrolling) were still not displaying in the expected colour. I managed to track down which colour was displaying but this seems to have no relationship to the colour number in Dpaint i.e. in Dpaint I made one bob out of colour 5 but BB was displaying it as colour 19? Any ideas why?
|
01 May 2017, 10:47 | #67 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
That's very odd. BOBs should match the palette 1:1. Are you sure you're not inadvertently poking a colour register somewhere during the screen setup?
As for the sprites, you shouldn't need a 32-colour screen to do that, but you do need a 32-colour palette object, rather than using the screen structure's own internal colours. |
03 May 2017, 21:27 | #68 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,908
|
Nope I don't do anything clever. I will post my code so you can see what I do (and maybe find out what I'm doig wrong).
|
03 May 2017, 21:35 | #69 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,908
|
Here it is - all graphics are 32 colour for simplicity and palette is 32 colours saved from Dpaint. Coll 19 is set as a colour for the sprite to collide with but in Dpaint I have to change colour 5 to change colour 19 in Blitz - go figure!
Code:
WBStartup LoadShape 0,"graphics/bl1" LoadShape 1,"graphics/bl2" LoadShape 2,"graphics/bl3" LoadShape 3,"graphics/bl4" LoadShape 4,"graphics/bl5" LoadShape 5,"graphics/bl6" LoadShape 6,"graphics/bl7" LoadShape 20,"graphics/run1" LoadShape 21,"graphics/run2" LoadShape 30,"graphics/catus1" LoadShape 31,"graphics/cactuts2" LoadShape 32,"graphics/cactuts3" LoadShape 33,"graphics/cactuts4" LoadPalette 0,"graphics/palette.pal" <--- 32 colour palette saved from Dpaint GetaSprite 0,20 BLITZ SetColl 19,5 DoColl ;set up foreground bitmap... ; BitMap 0,346,200,5 InitCopList 0,44,200,5,8,32,0 CreateDisplay 0 Use BitMap 0: Cls 31 DisplayPalette 0,0 a=0 :sp=2 x1=50:y1.f=150: an=1: jump=0: jj.f=8 cactus=0:level=2 :ct=100 score=0 :count=0 For n= 0 To 320 Step 16 bk=Int (Rnd(6)) If bk=6 Then Block bk,n,167 If bk<>6 Then Block bk,n,180 Next n While Joyb(0)=0 If Joyb(1)=1 AND jump=0 Then jump=1 If jump=1 Then jj=jj-.5: y1=y1-jj: If jj=0 Then jump=2 If jump=2 Then jj=jj+.5: y1=y1+jj: If jj>7 Then jump=0:jj=8 If a=0 bk=Int (Rnd(6)) If bk=6 Then Block bk,321,167 If bk<>6 Then Block bk,321,180 End If If cactus>ct bk=Rnd(4)+30 Block bk,321,146: cactus=0 :ct=100-Rnd((level-2)*10) End If cactus=cactus+Rnd(level) a=a+sp: If a>15 Then a=0 ;wait for vertical blank VWait BitMapOutput 0: Locate 1,1:Print "SCORE ":Print Int(score) score=score+.1 :count=count+.1: If count>100 Then level=level+1: count=0 Scroll sp,150,337,46,0,150 If an<6 Then DisplaySprite 0,0,x1,y1,0 If an>5 Then DisplaySprite 0,0,x1,y1,0 an=an+1 If an=5 Then GetaSprite 0,20 If an=11 Then an=0: GetaSprite 0,21 DoColl If PColl(0)=True Then Stop DisplayBitMap 0,0,0 Wend |
04 May 2017, 09:11 | #70 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,908
|
By the way, I know I can't spell cactus!
|
04 May 2017, 10:10 | #71 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Hmmm, I don't see anything untoward there with a quick look, though the SetColl command makes me suspicious, since it uses the two colours you're talking about. What happens if you commend out the SetColl line, or change it to different registers? It shouldn't affect anything, but it could be bugged.
|
04 May 2017, 13:44 | #72 |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 482
|
The two 'GetAsprite' inside the loop look suspicious. Why not switching the sprite without grabbing/converting a 'new' one from the Shape?
Also, make sure you have saved those single file shapes (brushes) correctly with the same number of colours you need. |
09 May 2017, 20:07 | #73 | |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,908
|
Quote:
Not sure what you mean about grabbing/converting - can you explain please. |
|
09 May 2017, 21:21 | #74 | |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Quote:
DisplaySprite 0,MySprite,x1,y1,0 Where MySprite is the sprite image you want to show. |
|
10 May 2017, 00:19 | #75 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,908
|
Righto so I can have lots of sprite objects - I was confused and thought I was only allowed 8! That makes sense - I will modify my code.
Still very confused by the whole colour thing - I wonder if it is an WinUAE issue? Will try running my game on my real 1200 to see what happens. |
10 May 2017, 01:29 | #76 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Yep, sprite *channels* are limited to 8, but you can have as many sprites objects as you specify in the compiler options, chip RAM permitting. You just decide which sprite object to show in each of the 8 channels at any one time.
I haven't had a chance to look at your code properly but might do over the next few days if I get a chance, see what's going on. Good idea to test it on real hardware - I can't imagine WinUAE would have such a glaring bug but you never know. |
22 May 2017, 21:13 | #77 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,665
|
I have an even stupider question here.
I recently found out about Amiblitz. So now I am confused about whether I should use Amiblitz or Blitz Basic 2.x? Stil lunsure if Amiblitz would let me create ocs/ecs games like the old one. [edit] One more: is there a way to work with a PC IDE for this, maybe even compile with one? It would make everything faster. Not really keen on burning my eyes staring at a 50/60Hz low res screen to make anything, really. I think someone made a notepad++ notation file for Blitz, this would be ideal scenario, I love notepad++ I use it for all my coding experiments Last edited by Amiga1992; 22 May 2017 at 21:33. |
22 May 2017, 21:39 | #78 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,381
|
I think you'd want the real Blitz 2, since AmiBlitz introduces FPU dependencies when you least expect it. So it's of no use if you want to make traditional games and demos for traditional machines.
Here's the thread about Notepad++ as a development environment for Blitz: http://eab.abime.net/showthread.php?t=86316 |
22 May 2017, 22:13 | #79 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,665
|
Yes I found the thread after mentioning it, thanks!
It's a shame that there's no cross-platform compiler for this. But I guess I can use WinUAE maxed out at speed. Thanks! |
22 May 2017, 22:14 | #80 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,381
|
It's not as though compiling in Blitz is slow. It's basically just a bunch of assembler macros.
|
Currently Active Users Viewing This Thread: 2 (0 members and 2 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[blitz basic] How much amiga-blitz friendly is this? | saimon69 | Coders. Blitz Basic | 105 | 21 April 2022 19:45 |
Blitz Basic (1) | Retro1234 | Coders. Blitz Basic | 9 | 18 February 2016 17:54 |
Blitz basic 2 Help | Havie | Coders. Blitz Basic | 30 | 08 September 2013 09:15 |
Blitz Basic 2 anyone? | jobro | request.Apps | 12 | 28 November 2005 18:15 |
Blitz Basic 2 | LaundroMat | Retrogaming General Discussion | 5 | 24 July 2001 08:10 |
|
|