Showing posts with label joystick. Show all posts
Showing posts with label joystick. Show all posts

Tuesday, 6 August 2019

Whoosh Hair

It didn't take long for the 'walking in the air' to get on my nerves - see the end of the previous diary entry here!

As a result, I spent an hour today pixelling a 'jump' left/right frame and then modifying my player movement routine to display the frame.  The result has been christened 'Whoosh Hair'!

I will be honest, I was inspired to pixel whoosh hair by a game I used to play on the Amiga called 'Kid Gloves 2', which made locks of the players hair 'stick up' when falling.

The jump now looks much better methinks - no silly mid-air walk!  Oh? What does it look like?  Something like this...



Next diary entry...
 

Friday, 19 April 2019

Joystick Detection

I fancy a mini-break from ChillED; it's occupying too much of my head-space at the moment and I need to do something different!

Thus, I've decided to write and slot into place the joystick detection code.  At the moment, the code is very general since it's not being called by any other routine or not actually doing anything itself other than detecting the joystick move.

To be honest, I've meddled with joystick code before in a previous project (Super Galax-I-Birds), so this new code is a modification of that projects code for Chiller 2 and it all starts with memory location $dc00.


; check joystick left, right and button press 

joy_check
   
           lda $dc00  
           sta joystick  
             
 joy_left  
           lda joystick  
           and #$04  
           bne joy_right  
             
           jmp joy_end     ; jsr to another routine in future!
             
 joy_right  
           lda joystick  
           and #$08  
           bne joy_fire  
             
           jmp joy_end     ; jsr to another routine in future!
        
 joy_fire       
           lda joystick  
           and #$10  
           bne joy_end
                           ; jst to another routine in future!
joy_end
           jmp joy_check


Memory location $dc00 can detect various joystick inputs by 'and'ing in various values as above.  In the code, if an input isn't detected, it skips and checks the next input, but if an input is detected some other code can be run, but here it just jumps down to the end at the moment.

Note, there is no detection for up or down because Chiller 2 won't be using those movements, otherwise it would be simple to add more code to the above for those movements also.

And it's that simple in assembly language to detect joysticks!

Next diary entry...