02 October 2017, 00:45 | #1 |
Registered User
Join Date: Jan 2014
Location: Cambs / UK
Posts: 356
|
Blitz: Any idea why sprites won't work
Hi Guys,
Any idea why sprites won't work in this code? When compiling I get "No currently used object!" Code:
getashape 24,0,97,16,16 getasprite 0,24 ;further on in code; :laserpos if laser = 1 showsprite 0,1,plyy,0 showsprite 0,304,plyy,1 endif return |
02 October 2017, 00:58 | #2 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
To use ShowSprite, you have to have a currently active slice. How have you set up the slices? You also need to switch to Blitz mode (shuts down the OS like most older games) before displaying any slices or sprites.
|
02 October 2017, 01:02 | #3 |
Registered User
Join Date: Jan 2014
Location: Cambs / UK
Posts: 356
|
Well I can't seem to get the raw text to display properly on notepad++ or gvim so I have put an adf in the zone with the source code and other files on. Sorry I can't give it to you any more convineient than that. Thr file is called "bees.adf"
|
02 October 2017, 01:14 | #4 |
Registered User
Join Date: Jan 2014
Location: Cambs / UK
Posts: 356
|
I am sure you are right by the way Daedalus! It most likely has something to do with my screen setup. As I really just thumbled my way through it and kept changing numbers until it worked. I kinda got what it all meant (well mostly) by the end.
|
02 October 2017, 01:20 | #5 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Ah, okay. It looks like you're using the Display Library for your display (which is good - it's more powerful than the Slices library), but you're using the Slices library sprite commands (ShowSprite). Change them to DisplaySprite instead and it should hopefully work.
The two libraries have similar functions but aren't compatible with each other, so you have DisplayBitmap and DisplaySprite instead of ShowBitmap and ShowSprite. DisplaySprite takes an extra parameter at the start that tells it which CopList to use, just be aware of that. Other than that, a couple of tips: When creating program labels, start them with a full stop, not a colon. For example: Code:
.MyLabel: Code:
:MyLabel Next, you can save your source as text from the SuperTED editor using the Save as ASCII... option. This will be readable in WordPad, Notepad++ or any other editor (not Windows Notepad - it doesn't understand Amiga line breaks). Finally, it's not essential but something to consider: creating a custom datatype for common properties will make your code more readable and less prone to bugs later on. Instead of having separate arrays for position, health etc., you can have them in one array of a Newtype. For example: Code:
Dim human.player(5) ... human(i)\x, human(i)\y Code:
Dim humanx.w(5), humany.w(5) ... humanx(i), humany(i) |
02 October 2017, 01:37 | #6 |
Registered User
Join Date: Jan 2014
Location: Cambs / UK
Posts: 356
|
This is great and makes sense. I am going to bed now so I will try it after work tomorrow. Thank you for all your help and the great tips. I am currently using the editor that comes with blitz2 (ped is it?). As far as i know superted comes with amiblitz. Are you saying I can use that editor and still compile blitz (i.e non fpu) code?
My Amiga has no fpu by the way I guess SuperTed itself does not require me to have one. The label thing is a huge tip. Thanks Not sure I quite get the variable thing yet but I will play with this tomorrow too. Thanks again for all your help. |
02 October 2017, 02:46 | #7 | |
Warhasneverbeensomuchfun
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
|
Quote:
Everything works pretty well this way You just have to be careful to not save anything on Amiblitz on Winuae when testing code, just use Notepad++ to save stuff |
|
02 October 2017, 07:35 | #8 |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,519
|
[OT]I know that earok did show that configuration but i still cannot figure out how to do it
|
02 October 2017, 09:18 | #9 | |
Registered User
Join Date: Oct 2008
Location: Finland
Posts: 643
|
Quote:
|
|
02 October 2017, 10:21 | #10 | |||
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Quote:
The editor for AmiBlitz is called Ped, and AFAIK requires an FPU to run, so don't worry about that one. Search for the Blitz Support Suite, on blitz-2000.co.uk (it's blocked in work here so I can't get an exact link). It includes an updated SuperTed, as well as updated deflibs and debugger files, all newer versions than the ones on the Blitz Extras disk. Quote:
Quote:
|
|||
06 October 2017, 14:56 | #11 |
Registered User
Join Date: Jan 2014
Location: Cambs / UK
Posts: 356
|
Thanks everyone for all your help so far. I am learning lots.
DisplaySprite is working great. One question tho. Is there away to turn the spriite off. i.e "DontDisplaySprite" type command. At the moment I am masking the sprite with a blank image when I am finished with it. Which kinda works but creates more problems down the line. I have look up BlitzMode at amigacoding.com but can't see any such command. Thanks |
06 October 2017, 18:04 | #12 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Hmmm... That is a slightly tricky one. AFAIK the "proper" way of disarming a sprite is to write 0 to the relevant sprite control register, referred to as SPR0CTL - SPR7CTL for channels 0 to 7 respectively (bear in mind they're 16-bit registers). However, I have never bothered doing this myself, either using a very simple single-pixel shape with no pixels as the sprite imagery when it's not needed, or else moving it to a negative X position, which puts it beyond the border of the screen and is thus invisible.
|
06 October 2017, 21:23 | #13 |
Registered User
Join Date: Jan 2014
Location: Cambs / UK
Posts: 356
|
Well moving it off the screen works much better than masking it out. Out of sight out of mind!
Thanks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How did Amiga sprites work? | Foebane | Retrogaming General Discussion | 13 | 29 May 2017 16:41 |
SimpleFTP won't work | jdog320 | support.WinUAE | 9 | 12 January 2016 21:38 |
Pegasus won't work | Tim Janssen | support.WinUAE | 7 | 13 May 2004 09:39 |
miami won`t work | jambamiga | support.WinUAE | 4 | 01 November 2002 03:53 |
HD emulation won't work | Grimlock126 | support.WinUAE | 7 | 06 July 2001 19:11 |
|
|