base:merge_char_bullets
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | base:merge_char_bullets [2015-04-17 04:32] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Merge char bullets with background chars ====== | ||
+ | by Achim | ||
+ | |||
+ | Char bullets look quite ugly when flying around. A way to achieve a more aesthetic look is to generate new chars on the fly everytime the bullet' | ||
+ | |||
+ | First thing to do is to reserve as many empty chars in your charset as you need bullets in your game. | ||
+ | |||
+ | For example 8 chars: | ||
+ | < | ||
+ | charset: | ||
+ | 8 empty chars: | ||
+ | char values: | ||
+ | </ | ||
+ | |||
+ | Now you need a positive and a negative image/char of your char bullet.\\ | ||
+ | \\ | ||
+ | Negative image\\ | ||
+ | {{: | ||
+ | Positive image\\ | ||
+ | {{: | ||
+ | |||
+ | |||
+ | The negative has to be done with $d021 and $d800/ | ||
+ | $d800 should only be used for the positive when all chars got the same color RAM. Otherwise the bullets | ||
+ | change their color accordingly everytime they move ahead which might look stupid. | ||
+ | |||
+ | Everytime the main program places a new bullet on screen respectively moving the char bullet on screen, | ||
+ | it first has to read and save the char underneath the bullet. | ||
+ | |||
+ | < | ||
+ | ldy screencolumn // | ||
+ | lda (screenposition), | ||
+ | sta charstorage, | ||
+ | jsr chargenerator // | ||
+ | </ | ||
+ | |||
+ | Now the new char has to be generated: | ||
+ | |||
+ | < | ||
+ | .const charsethibyte = $20 / | ||
+ | .const negativechar = $2008 //2. char in charset | ||
+ | .const positivechar = $2010 //3. char in charset | ||
+ | |||
+ | //acc still holding value of saved char | ||
+ | //x-reg still pointing at currently used char bullet | ||
+ | //y-reg still holding current screen column | ||
+ | |||
+ | chargenerator: | ||
+ | asl | ||
+ | asl | ||
+ | sta tmp0 //get low byte of chardata in charset -> tmp0=zp address | ||
+ | lda (screenposition), | ||
+ | lsr | ||
+ | lsr | ||
+ | lsr | ||
+ | lsr | ||
+ | lsr | ||
+ | clc | ||
+ | adc # | ||
+ | sta tmp1 //get hi byte of chardata in charset | ||
+ | |||
+ | lda charsetposition, | ||
+ | sta writechar+1 // | ||
+ | |||
+ | ldy #$07 | ||
+ | !: lda (tmp0), | ||
+ | genand: | ||
+ | genora: | ||
+ | writechar: | ||
+ | dey | ||
+ | bpl !- | ||
+ | |||
+ | lda newcharvalue, | ||
+ | ldy screencolumn // | ||
+ | sta (screenposition), | ||
+ | rts | ||
+ | |||
+ | charsetposition: | ||
+ | newcharvalue: | ||
+ | </ | ||
+ | |||
+ | Check out these games to see how it looks: | ||
+ | |||
+ | http:// | ||
+ | http:// | ||
base/merge_char_bullets.txt · Last modified: 2015-04-17 04:32 by 127.0.0.1