Re: [stella] Object handler organisation

Subject: Re: [stella] Object handler organisation
From: Manuel Polik <cybergoth@xxxxxxxx>
Date: Thu, 07 Nov 2002 15:15:29 +0100
Hi Thomas!

>>Once again more coding advice is needed.

>Or no subroutines at all, and just a big mess of code, 

Hey, that's where I come from! ;-)

Well, until now I managed to merge the general and the 
joystick movement into one block, plus I generalized it 
even more, so that it may be executed for all objects.

For the moment that works ;-)

I just hoped, that maybe there was some better general 
approach to the problem...

Oh, BTW: Here's a very cool snippet I recently coded:

Assuming you want to either add or subtract some values, 
like some enemy movement. You'd probably do +-2 or +-3 
or something like that to your x/y positions.

Assuming you'd like to merge both of these values into 
one single byte.

Assuming you'd have it like this:

FREEX110 for add 3
FREEX111 for sub 3

Then here is the snippet:

    LDA xymov,X
    LSR				; Will save one LSR later...
    TAY
    AND #$07
    BCS .MoveLeft
    ADC xpos,X			; Carry is clear! Fine!
    JMP .HorMoveDone

.MoveLeft
    EOR #$FF			; Carry is set! Excellent!
    ADC xpos,X
.HorMoveDone
    STA xpos,X

;-)

Greetings,
	Manuel

----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread