AMAL type sprite animation language

BlitzPlus Forums/BlitzPlus Programming/AMAL type sprite animation language

Kevin_(Posted 2004) [#1]
Been tinkering a bit and have come up with an AMAL type animation language for sprite control within Blitz. If you remember AMOS on the Amiga then you will know what I'm talking about.

I thought it would be a good idea to implement as it is so easy to keep track of your sprites using this kind of technique.

I currenty have a (very) basic string evaluator to interpret the AMAL programs within. I'll do some more tomorrow and maybe post some code.

What are peoples feelings on this? Would you find it useful? And what sort of features would you like included?


sswift(Posted 2004) [#2]
I don't know what this sprite system on the amiga did, but my bobs system makes it easy to keep track of and move sprites and the anibob system it comes with automates animating linear or sine motion, color, frame, etc.


VIP3R(Posted 2004) [#3]

what does it do exactly?


AMAL in AMOS was like an IRQ system (interrupts), it wasn't just for animation you could use it for sound and other stuff too.

You setup the AMAL to do a task, then the instructions were processed automatically without taking more time off the CPU.


Kevin_(Posted 2004) [#4]
I've managed to read AMAL programs within a string.

example....
[Code]

; AMAL Demo (very early version)
;
; This example moves a sprite accros the screen changing its image. It then repeats.
;

Include "AMAL.bb" ; Always include the AMAL file first!


Graphics 640,480,32,2
SetBuffer BackBuffer()

Color 255,0,0:Rect 0,0,31,31 ; Create a sprite image
Sprite_Grab(1,0,0,31,31) ; Grab it to image Bank. (Image_No,x,y,w,h)

Color 0,255,0:Rect 0,0,31,31 ; create another sprite image (2)
Sprite_Grab(2,0,0,31,31)

Color 0,0,255:Rect 0,0,31,31 ; Create a third sprite image
Sprite_Grab(3,0,0,31,31)

Color 255,0,255:Rect 0,0,31,31 ; Create a forth sprite image
Sprite_Grab(4,0,0,31,31)

Color 0,255,255:Rect 0,0,31,31 ; Create a fifth sprite
Sprite_Grab(5,0,0,31,31)



a$="LA:" ; Label A

a$=a$+"X = 0000:" ; Start X Position at 0
a$=a$+"Y = 0000:" ; Start Y Position at 0
a$=a$+"A = 0001:" ; Change the image to Anim Frame 1 from the image bank
a$=a$+"P:" ; Pause. Stops execution. Resumes next time around.

a$=a$+"X + 0050:" ; Move it right 50 pixels relative to current X
a$=a$+"Y + 0000:" ; Leave the Y coordinate alone
a$=a$+"A = 0002:" ; Change Image to image No 2 from the Image bank
a$=a$+"P:" ; Pause

a$=a$+"X + 0050:" ; Move it right 50 pixels
a$=a$+"Y + 0000:" ;
a$=a$+"A = 0003:" ; Change image to Image No 3
a$=a$+"P:" ; Pause

a$=a$+"X + 0050:" ; Move it right 50 pixels
a$=a$+"Y + 0000:" ;
a$=a$+"A = 0004:" ; Change Image to Image No 4
a$=a$+"P:" ; Pause

a$=a$+"X + 0050:" ; Move it right 50 pixels
a$=a$+"Y + 0000:" ;
a$=a$+"A = 0005:"
a$=a$+"P:" ; Pause

a$=a$+"JL LA:" ; Jump to Label LA

AMAL$(1)=a$ ; Assign the animation string to an AMAL channel.


Cls

Repeat


Synchro(1,1) ; Execute AMAL strings from S to E (range 1 to 255)
Sprite_Draw(1,1) ; Draw all sprites from S to E (range 1 to 255)

Flip:Cls

Until KeyHit(1)
End

[/Code]


If you try and run it, it wont work because I haven't included the AMAL.bb source.

To do.....

1. Local internal variables. Probably RA to RZ to remain compatible with AMOS.

2. Condition checking then branch. eg 'IF X = 640 JUMP LB:'

3. An 'EXIT' instrunction.

4. External commands to retrieve values from within an AMAL program.

5. Probably more.....