English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 09 December 2018, 23:33   #1
Havie
Registered User
 
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,894
Sprites and Displaybitmap

I have a screen that is 640x400 and I am using Displaybitmap to scroll around using the mouse. My problem is that my main character is a sprite and it seems that sprite coordinates are independent of screen coordinates as when I change the x and y offset of the screen to scroll around, the sprite doesn't move!

Any suggestions?

P.S. Works ok if I blit a shape but would rather use a sprite!
Havie is offline  
Old 10 December 2018, 18:46   #2
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,341
Yep, that's normal. Sprites are an entirely different layer of the display to the bitmap, so operate completely independently. The sprite coordinates are always relative to the actual display, regardless of what's being displayed. To have them match the scrolling, you'll need to offset them by the scroll position. So, if your bitmap view is (25,60), your sprite position will be (spritex-25, spritey-60). This means you will have to update the sprite positions at the same time as you update the bitmap position, otherwise you it won't look right.
Daedalus is offline  
Old 10 December 2018, 20:36   #3
Havie
Registered User
 
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,894
Yes - have thought about this over night and guess this would be the answer (a part of me was hoping there might be some 'magic' solution which would mean that I don't have to add the offsets to all the sprites

So, if I'm right and you use a dual playfield with sprites then technically there are 3 layers?
Havie is offline  
Old 10 December 2018, 22:53   #4
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,341
Yep - and some games even use sprites to create a third layer of parallax. On AGA especially, you can cover the entire width and height of the screen with 5 sprites so it's a nice option.
Daedalus is offline  
Old 12 December 2018, 14:46   #5
Shatterhand
Warhasneverbeensomuchfun
 
Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
[ Show youtube player ]

This was done on Blitz Basic, and I don't think I'll ever make anything out of it.

This is a way to make a nice parallax with "animated" backgrounds using sprites and dual playfield. The main character is also made of two 3 colors sprites...

The Amiga Hardware is interesting because there are many different ways you can approach coding your game. It's interesting but also a bit complicated as you usually have to plan well ahead before writing any line of code
Shatterhand 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
Some sprites Frog project.Sprites 6 22 August 2022 20:01
Barbarian 2 sprites Maxim project.Sprites 13 21 July 2021 12:44
SuperCars II sprites Lazarus404 project.Sprites 23 18 June 2020 15:53
Feud Sprites theflashguy project.Sprites 8 14 March 2011 10:49
Where are all the sprites? Gambit37 project.Sprites 8 14 October 2005 14:49

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 23:38.

Top

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