Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user nurd ! (Registered 2024-06-16) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Negative sprite X-position ?
2009-09-26 09:26
SIDWAVE
Account closed

Registered: Apr 2002
Posts: 2238
Negative sprite X-position ?

Hehe I kinda know it isnt doable, but still, i would ask what to do..

An expanded sprite goes to X-pos 0, and then half of it is visible on the screen.

So, when scrolling left, it suddenly disappears when it hits X-pos 0.

This looks ugly :D

If i set D010 at this point, its still not possible to give it a position, so it is hiding under the left border.

So what can i do ?


I have thought about the insane work, to, when X-pos=0, to start a left scrolling of the sprite data. This isnt very appealing to have to code.. :D

Also, dont we get the same problem if the whole sideborder is gone ? when sprite at pos 0 = it suddenly vanishes from there, because you set d010 and give it another position ?


I dont know what to do.
Ofcourse NOT using expanded sprites solves the problem, and my flying sprites can look nice.. but i WANT them expanded.


Anyone ?
 
... 9 posts hidden. Click here to view all posts....
 
2009-09-27 15:40
JackAsser

Registered: Jun 2002
Posts: 1995
Quote: Jackasser: i asked how to hide an expanded sprite behind the left border, completely - and got it working with help from Groepaz.

d010=x1
d000=224 ;it is now completely hidden

so thats all.

Thanks for your input!


And I answered in a general way trying to give some hints but ok... :)

Border ends at 24. An expanded sprite is 48. To hide it you must place it at 24-48 = -24. But since -24 < 0 we must subtract by 8 => -24-8 = -32 ($e0 = 224).


2009-09-27 21:13
SIDWAVE
Account closed

Registered: Apr 2002
Posts: 2238
Quote: And I answered in a general way trying to give some hints but ok... :)

Border ends at 24. An expanded sprite is 48. To hide it you must place it at 24-48 = -24. But since -24 < 0 we must subtract by 8 => -24-8 = -32 ($e0 = 224).




You keep telling me stuff I already know :D

The sprites use 3 bytes for x-pos; the 3rd is for the d010 gap in left side (pos 224-247).
2009-09-28 07:08
The Human Code Machine

Registered: Sep 2005
Posts: 110
Quote: You keep telling me stuff I already know :D

The sprites use 3 bytes for x-pos; the 3rd is for the d010 gap in left side (pos 224-247).


Why does a sprite need 3 bytes for x-pos? I always thought only 9 bits are needed for the x-pos?
2009-09-28 09:49
SIDWAVE
Account closed

Registered: Apr 2002
Posts: 2238
Well, yes, but actually it is 3 seperate counters, so i decided to use a byte for it, instead of using 1 byte for 2 different things.

0-255 | d010,0
0-159 | d010,1
224,247 | d010,1

So to make the code easier, i use 3 bytes..
2009-09-28 10:51
JackAsser

Registered: Jun 2002
Posts: 1995
Quote: Well, yes, but actually it is 3 seperate counters, so i decided to use a byte for it, instead of using 1 byte for 2 different things.

0-255 | d010,0
0-159 | d010,1
224,247 | d010,1

So to make the code easier, i use 3 bytes..


To make the code even easier you can use two bytes per sprite that represents -32768..32767. :P
2009-09-28 11:07
WVL

Registered: Mar 2002
Posts: 887
Quote: Well, yes, but actually it is 3 seperate counters, so i decided to use a byte for it, instead of using 1 byte for 2 different things.

0-255 | d010,0
0-159 | d010,1
224,247 | d010,1

So to make the code easier, i use 3 bytes..


Easy?



Like Jackasser said : just use a 16-bit coordinate system.

You can improve it a bit further with some small checks :

5. position >$180? then position is $180
6. position <-$c0? then position is -$c0

This fixes the 'wraparounds'
2009-09-28 12:32
HCL

Registered: Feb 2003
Posts: 717
Heh. :D. I'd better not make a comment on this..
2009-09-28 12:47
WVL

Registered: Mar 2002
Posts: 887
Quote: Heh. :D. I'd better not make a comment on this..

Let me guess : you have an ever easier system using 5 bytes? ;)
2009-09-28 13:22
Jetboy

Registered: Jul 2006
Posts: 232
Why limit yourself to only using 5 bytes where there is so many of them available? :)
2009-09-29 01:25
SIDWAVE
Account closed

Registered: Apr 2002
Posts: 2238
Jackasser: yes I see now.... :D

I must have been blind..
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
sailor/Triad
Sentinel/Excess/TREX
stephan-a
El Jefe/Slackers^sidD
Guests online: 104
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.7)
6 Aliens in Wonderland  (9.6)
7 Comaland 100%  (9.6)
8 No Bounds  (9.6)
9 Uncensored  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 Rainbow Connection  (9.5)
6 It's More Fun to Com..  (9.5)
7 Dawnfall V1.1  (9.5)
8 Daah, Those Acid Pil..  (9.5)
9 Birth of a Flower  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Nostalgia  (9.4)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 SHAPE  (9.3)
Top Graphicians
1 Mirage  (9.8)
2 Archmage  (9.7)
3 Talent  (9.6)
4 Facet  (9.6)
5 Hend  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.05 sec.