Starfield demo
Starfield demo
Ok, I didn't think I would be able to finish this fast, but here's that starfield demo with source code I promised.
My first program for Creativision
My first program for Creativision
You do not have the required permissions to view the files attached to this post.
Re: Starfield demo
Hi,
very nice, thank you.
very nice, thank you.
Re: Starfield demo
Thanks a lot. Very nice indeed!!!
I'll try to study the source code asap.
I'll try to study the source code asap.
Re: Starfield demo
I'm actually not using the same method as I did in Photon. Before I used 128 characters for stars, because I only used sprites for the rest of the game. Here I only use two, because in Photon 2 I'm going to have software sprites, so I needed a different approach. As you see, it also takes a lot of shortcuts to be fast and have a small memory footprint. You can see the pattern of stars repeat. There's still some improvements I could do, like changing colors.
Re: Starfield demo
I still need to figure out the "logic" of the routines that make characters change to resemble scrolling stars.
Re: Starfield demo
I thought I would explain a little and realized I change even the slow star character every frame, even though it only moves every other frame. Maybe I should have implemented it differently.
Anyway, this code:
fills the character for the slow star with zero except on the row specified by slowchar, where it puts 8 instead (the star).
So, by increasing slowchar the star moves down one pixel.
The routine is exactly the same for the fast star.
Then, this code:
increases the value of fastchar by one every frame, until it reaches eight, when it resets to zero (so the star will be in the top of the character again).
When it resets to zero, I also call the routine move_stars, which moves the character down on the screen.
I hope that explains it a little.
Anyway, this code:
Code: Select all
ldx #0 ; Edit slow character
ml4:
lda #0
cpx slowchar
bne ml5
lda #8
ml5:
sta VDP_Data_Write
inx
cpx #8
bne ml4
So, by increasing slowchar the star moves down one pixel.
The routine is exactly the same for the fast star.
Then, this code:
Code: Select all
ldx fastchar ; Change vertical position of star inside fast character
inx
cpx #8
bne lo3$
ldy #16
jsr move_stars ; Move fast character
ldx #0
lo3$:
stx fastchar
When it resets to zero, I also call the routine move_stars, which moves the character down on the screen.
I hope that explains it a little.
Re: Starfield demo
Here's a new version with some blinking stars.
You do not have the required permissions to view the files attached to this post.
Re: Starfield demo
I need to study it a bit. I looked at the source code and it seems quite readable
btw I see no blinking stars there.
btw I see no blinking stars there.
Re: Starfield demo
Well, they are changing color in this order: grey, dark yellow, light yellow, white and back again.
Re: Starfield demo
There must be some issue with my emulator... I see always the same colour.