English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 30 November 2020, 13:25   #1
geldo79
Registered User
 
geldo79's Avatar
 
Join Date: Oct 2019
Location: Eydelstedt / Germany
Age: 44
Posts: 114
Question energy bar

Hi,

for my little spacewar-like game, i want to draw a bar for each space ship which gives information about the remaining energy.

What approach would you guys use? I think there must be several:

- just write a method for setting the pixels
- using the blitter in line mode and fill the corresponding area
- use the copper to change colors in the corresponding lines
- ...

Greetings
Christian
geldo79 is offline  
Old 30 November 2020, 17:51   #2
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,454
Generally, I think I'd opt to draw the bar in some fashion (either directly setting the pixels on the bitmap or by using HW sprites and changing them). If the bar is very accurate and the changes are usually small, it might even be faster to use the CPU to update the image*. If the bar is updated in larger chunks instead, I'd probably just store some bitmaps containing the various bar chunks and blit them.

I'd probably not bother with line mode (it's not likely to be any faster than other forms of blitting, but is more tricky to set up). Copper is interesting, but probably limits you quite a bit in size/precision of updates.

*) Very small drawing operations are faster with th1e CPU because the overhead of setting the Blitter registers can be avoided. Do note this is only true for very small updates - it'll become faster to use the Blitter instead quite quickly once the updates become bigger.
roondar is offline  
Old 02 December 2020, 08:38   #3
geldo79
Registered User
 
geldo79's Avatar
 
Join Date: Oct 2019
Location: Eydelstedt / Germany
Age: 44
Posts: 114
Thanks. Decided to draw it by setting the pixels directly. Works perfectly. I attached a screenshot of my game so far.
Attached Thumbnails
Click image for larger version

Name:	space2.png
Views:	176
Size:	4.2 KB
ID:	69842  
geldo79 is offline  
Old 02 December 2020, 10:33   #4
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,454
Nice, looking forward to more updates
roondar is offline  
Old 02 December 2020, 12:36   #5
geldo79
Registered User
 
geldo79's Avatar
 
Join Date: Oct 2019
Location: Eydelstedt / Germany
Age: 44
Posts: 114
I made a short video of the gameplay (.avi in zip-file). Thats how it looks like at the moment. The energy bar moves around just for testing. Next step is to implement its function (damage of ships)....and to implement some kind of explosion when the energy is zero.
Attached Files
File Type: zip gameplay.zip (2.59 MB, 89 views)
geldo79 is offline  
Old 02 December 2020, 13:42   #6
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,454
Nice, it's very smooth in both movement and rotation. Looks like it could be good fun once completed.
roondar is offline  
Old 02 December 2020, 15:24   #7
geldo79
Registered User
 
geldo79's Avatar
 
Join Date: Oct 2019
Location: Eydelstedt / Germany
Age: 44
Posts: 114
Thanks a lot! To have fast and smooth movements is my main goal. I thinks it is a precondition for having fun with a space shooter game like this.
geldo79 is offline  
Old 03 December 2020, 21:35   #8
fstarred
Registered User
 
fstarred's Avatar
 
Join Date: Mar 2018
Location: Rome
Posts: 173
As already said by roondar, animations are smooth and fast as well, very good. I wonder if gameplay may be similar to Star Control, one of my favourite games for amiga and pc. Does it run on Amiga 500?
Good job!
fstarred is offline  
Old 03 December 2020, 22:06   #9
geldo79
Registered User
 
geldo79's Avatar
 
Join Date: Oct 2019
Location: Eydelstedt / Germany
Age: 44
Posts: 114
Thanks. Yes, it runs on A500. I am coding this game on an A500 using ASMOne v1.15. And sometimes in WinUAE using a backup of my A590 hard disk.
geldo79 is offline  
Old 03 December 2020, 22:19   #10
Rotareneg
Registered User
 
Rotareneg's Avatar
 
Join Date: Sep 2017
Location: Kansas, USA
Posts: 329
As for the original topic of health bars: If you can use a vertical health bar, sprites are another option.
Rotareneg is offline  
Old 03 December 2020, 22:59   #11
sparhawk
Registered User
 
sparhawk's Avatar
 
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
Quote:
Originally Posted by Rotareneg View Post
As for the original topic of health bars: If you can use a vertical health bar, sprites are another option.

But sprites are limited to four colors. Or he would have to use several of them.
sparhawk is offline  
Old 04 December 2020, 08:22   #12
geldo79
Registered User
 
geldo79's Avatar
 
Join Date: Oct 2019
Location: Eydelstedt / Germany
Age: 44
Posts: 114
In the status panel area, no sprites are used at the moment. Only the space ships are attached sprites with 16 colours. I agree, I could of use attached sprites for the health bars too. For the moment i'll use the existing approach because it is simple and works.
geldo79 is offline  
Old 04 December 2020, 10:19   #13
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,454
For a vertical energy bar, you could also use non-attached sprites: simply use the Copper to change the colour register(s) that corresponds to the bar being shown.
roondar is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Purple bar in WB Dustyarddog support.Hardware 2 13 February 2020 09:19
pure energy disks alienkidmj12 request.Apps 1 26 August 2019 22:58
Energy (Holodream) Heavy Stylus request.Old Rare Games 4 25 April 2013 13:11
LED Bar(s) Charlie support.Hardware 3 12 October 2009 22:55
Blues Brothers trained +17 by Energy bobbybearing request.Old Rare Games 0 27 November 2006 18:23

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:27.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10962 seconds with 14 queries