It is currently Thu Dec 13, 2018 4:30 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Sprite 0 Hit
PostPosted: Thu Jul 13, 2006 12:56 am 
Offline
User avatar

Joined: Sun Mar 19, 2006 12:37 am
Posts: 223
Location: San ANto, TX
Hello Again,
I want to make a demo where a ball bounces back and forth up and down through the screen randomly. Would i use sprite 0 hit to make the ball change directions once it has reached the screen borders or use Y and X cordinates with branches.

Thanks
EL

_________________
" If I have seen further it is by standing on the shoulders of giants" - Issac Newton, in a letter to Robert Hooke.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 13, 2006 4:48 am 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1849
No

Sprite 0 Hit is typically used for raster effects, like knowing when the screen is rendering a certain scanline so you can split it. This is a more advanced area than you're ready for.

So no, you would not use Sprite 0 hit for that. For that, you would just check the ball's X,Y position and change it's direction when it got too large/small.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 13, 2006 1:41 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11011
Location: Rio de Janeiro - Brazil
Not even if you wanted would you be able to use the sprite hit flag for that. As the name says, it's just a flag: sprite hit background or sprite didn't hit background (hit means that a solid pixel from the sprite and a solid pixel from the background trying to be displayed at the same screen pixel - doesn't matter who wins, wich depends on the priority of the sprite).

The only way to use that in your favour is if you draw a border around the screen using only solid colors (colors 1, 2 or 3) and keep a big rectangle in the middle of the screen using color 0, so that when you detect a hit you know the sprite hit the border. But you still wouldn't know wich border (there are 4 of them, right?), wich means you wouldn't know whether you have to change the horizontal or vertical movement of the object. For that you'd have to check it's coordinates anyway, wich means it's much better to do it only by checking the coordinates. This is not what the hit flag is for.

Also, if you don't use sprite hits for this, you can draw a nice background behind the moving object, something you couldn't if using sprite hits.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 13, 2006 2:08 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3598
Location: Indianapolis
Compare sprite coordinates to the border X/Y, check the C flag with BCS/BCC and you can use that as a greater-than/less-than check, like it shows here:
http://www.6502.org/tutorials/compare_instructions.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group