Jump to content
IGNORED

Animation and Special Effect Contest


matthew180

Recommended Posts

I wrote this a while back, in TurboForth. Here is the video:

 

http://www.youtube.com/watch?v=qBdGd52A3gs

 

( ** StarField Sprite Demo ** )

VARIABLE RND HERE RND ! ( seed )
VARIABLE StringSpace
82 CHARS ALLOT 	        ( create a string buffer )
StringSpace 84 32 FILL 	( initialise it to ASCII 32 )
S" The Power Of Forth!" ( addr len )
StringSpace 		( addr len addr )
SWAP 			( addr addr len )
CMOVE> 			( move string into buffer )

0 VALUE FlipFlop

( ascii codes for small, medium, and big stars )
64 CONSTANT Sml* 
65 CONSTANT Med* 
66 CONSTANT Big*

( keyboard codes )
CHAR E CONSTANT KeyE
CHAR S CONSTANT KeyS
CHAR D CONSTANT KeyD
CHAR X CONSTANT KeyX

( define colours )
15 CONSTANT White
9  CONSTANT TEN

( set up user defined graphics for the 3 star sizes )
: UDG 8000$    0  0 0 4 Sml* DCHAR ( define small star )
     40E0$ 4000$ 0 0 4 Med* DCHAR ( define medium star )
     70F8$ F870$ 0 0 4 Big* DCHAR ( define large star ) ;

: RANDOM ( limit -- rnd ) 
 RND @ 31421 * 6927 + DUP RND ! ABS SWAP MOD ;

( generate a random Y coordinate )
: RndY 180 RANDOM ;

( generate a random X coordinate )
: RndX 256 RANDOM ;

( set up our sprites. 10 small, 10 medium, 10 large )
: 10Small TEN FOR I       RndY RndX Sml* White SPRITE NEXT ;
: 10Med   TEN FOR I 10 +  RndY RndX Med* White SPRITE NEXT ;
: 10Big   TEN FOR I 20 +  RndY RndX Big* White SPRITE NEXT ;

( set up the sprite movement list for each direction )
: GoLeft  TEN FOR I       0 -1 SMLIST NEXT 
         TEN FOR I 10 +  0 -2 SMLIST NEXT 
  TEN FOR I 20 +  0 -3 SMLIST NEXT ;

: GoRight TEN FOR I       0  1 SMLIST NEXT 
         TEN FOR I 10 +  0  2 SMLIST NEXT 
  TEN FOR I 20 +  0  3 SMLIST NEXT ;

: GoUp    TEN FOR I      -1  0 SMLIST NEXT 
         TEN FOR I 10 + -2  0 SMLIST NEXT 
  TEN FOR I 20 + -3  0 SMLIST NEXT ;

: GoDown  TEN FOR I       1  0 SMLIST NEXT 
         TEN FOR I 10 +  2  0 SMLIST NEXT 
  TEN FOR I 20 +  3  0 SMLIST NEXT ;

: Delay 100 FOR NEXT ;

: DoFlipFlop FlipFlop NOT DUP TO FlipFlop ;

: ScanKeys 
  KEY? CASE 
   KeyE OF GoUp    ENDOF 
     KeyS OF GoLeft  ENDOF
     KeyD OF GoRight ENDOF
     KeyX OF GoDown  ENDOF
  ENDCASE
  BREAK?
;

: Scroll 
  DoFlipFlop IF 
    [ StringSpace 83 + LITERAL ] C@
    [ StringSpace LITERAL StringSpace 1+ LITERAL ] 83 CMOVE>
    [ StringSpace LITERAL ] C!
    0  0 GOTOXY [ StringSpace 32 + LITERAL ] 31 TYPE
    0 23 GOTOXY [ StringSpace 32 + LITERAL ] 31 TYPE
    ScanKeys
  THEN
;

: Setup 
   1 GMODE  0 SCREEN  UDG  10Small 10Med 10Big GoRight ;

: GO
   Setup BEGIN 0 30 SPRMOV Scroll Delay AGAIN ;

 

:cool:

Link to comment
Share on other sites

 

 


And Sometimes.... That flip effect is very intriguing!!

 

icon_smile.gif If you arrange characters(/font) and colors, then the effect could be something like with my 5 year old demo ...

The still effect of things or text reflecting in water has been used for more than one hundred years.

Edited by sometimes99er
Link to comment
Share on other sites

I can't compete with you Assembly gurus but here is a little XB routine that I developed to use with a game I am developing at the moment (on and off anyway....). For the purpose of this thread I named it XB-SCROLL. This is my best attempt at "high res" smooth scrolling in BASIC.

 

1 ! XB-SCROLL

100 CALL CLEAR :: DISPLAY AT(2,11):"XB-SCROLL" :: CALL CHAR(128,RPT$("F",16),129,"00C0E0FEC778")

110 FOR I=96 TO 127 STEP 4 :: READ A$ :: CALL CHAR(I,A$) :: A=A+1 :: FOR D=0 TO 3 :: B$(A)=B$(A)&CHR$(I+D) :: NEXT D :: NEXT I

120 DISPLAY AT(16,1):RPT$(B$(1),7);RPT$(CHR$(128),224) :: CALL SPRITE(#1,129,16,100,30)

130 FOR I=1 TO 8 :: DISPLAY AT(16,1):RPT$(B$(I),7) :: B$(I)=SEG$(B$(I),2,3)&SEG$(B$(I),1,1) :: NEXT I :: GOTO 130

140 DATA 0000001D3F7FFFFF002078FDFFFFFFFF000E3FFFFFFFFFFF0000C0E0F0FEFFFF,0000003B7FFFFFFF0040F0FBFFFFFFFF001C7FFFFFFFFFFF000080C0E0FCFFFF

150 DATA 00000177FFFFFFFF0080E0F7FFFFFFFF0038FFFFFFFFFFFF00000080C0F9FFFF,000103EFFFFFFFFF0000C1EFFFFFFFFF0070FEFFFFFFFFFF0000000081F3FFFF

160 DATA 000207DFFFFFFFFF000083DFFFFFFFFF00E0FCFEFFFFFFFF0000000103E7FFFF,00040FBFFFFFFFFF000107BFFFFFFFFF00C0F8FCFEFFFFFF0000000307CFFFFF

170 DATA 00081E7FFFFFFFFF00030F7FFFFFFFFF0080F0F8FCFFFFFF000000070F9FFFFF,00103CFEFFFFFFFF00071FFFFFFFFFFF0000E0F0F8FFFFFF0000000E1F3FFFFF

Edited by Bones-69
Link to comment
Share on other sites

I can't compete with you Assembly gurus but here is a little XB routine that I developed to use with a game I am developing at the moment (on and off anyway....). For the purpose of this thread I named it XB-SCROLL. This is my best attempt at "high res" smooth scrolling in BASIC.

 

1 ! "XB-SCROLL"
100 CALL CLEAR :: DISPLAY AT(2,11):"XB-SCROLL" :: CALL CHAR(128,RPT$("F",16),129,"00C0E0FEC778")
110 FOR I=96 TO 127 STEP 4 :: READ A$ :: CALL CHAR(I,A$) :: A=A+1 :: FOR D=0 TO 3 :: B$(A)=B$(A)&CHR$(I+D) :: NEXT D :: NEXT I
120 DISPLAY AT(16,1):RPT$(B$(1),7);RPT$(CHR$(128),224) :: CALL SPRITE(#1,129,16,100,30)
130 FOR I=1 TO 8 :: DISPLAY AT(16,1):RPT$(B$(I),7) :: B$(I)=SEG$(B$(I),2,3)&SEG$(B$(I),1,1) :: NEXT I :: GOTO 130
140 DATA 0000001D3F7FFFFF002078FDFFFFFFFF000E3FFFFFFFFFFF0000C0E0F0FEFFFF,0000003B7FFFFFFF0040F0FBFFFFFFFF001C7FFFFFFFFFFF000080C0E0FCFFFF
150 DATA 00000177FFFFFFFF0080E0F7FFFFFFFF0038FFFFFFFFFFFF00000080C0F9FFFF,000103EFFFFFFFFF0000C1EFFFFFFFFF0070FEFFFFFFFFFF0000000081F3FFFF
160 DATA 000207DFFFFFFFFF000083DFFFFFFFFF00E0FCFEFFFFFFFF0000000103E7FFFF,00040FBFFFFFFFFF000107BFFFFFFFFF00C0F8FCFEFFFFFF0000000307CFFFFF
170 DATA 00081E7FFFFFFFFF00030F7FFFFFFFFF0080F0F8FCFFFFFF000000070F9FFFFF,00103CFEFFFFFFFF00071FFFFFFFFFFF0000E0F0F8FFFFFF0000000E1F3FFFFF

Wow ! That's excellent scrollin' ! :thumbsup:

Link to comment
Share on other sites

That is some pretty good scrolling! I wonder if it might be even faster to just change the patterns of the characters instead of redrawing the line each time through the loop?

I suspect I could speed the scrolling up, and therefore the smoothness, by at least double (maybe more) - at the cost of a longer program initialisation and using more memory by converting the entire process to strings in advance and then just calling each string in a loop rather than calculating the display each time. I will throw something together later as an example.... In a program environment (if memory allowed), it would certainly be the better way to do it.

Link to comment
Share on other sites

I managed to speed it up a little. Almost smooth now, but at the cost of a little more memory...

 

100 ! XB-SCROLL-2

110 ! BONES

120 DIM C$(32) :: CALL CLEAR :: DISPLAY AT(2,11):"XB-SCROLL" :: CALL CHAR(128,RPT$("F",16),129,"00C0E0FEC778")

130 FOR I=96 TO 127 STEP 4 :: READ A$ :: CALL CHAR(I,A$) :: A=A+1 :: FOR D=0 TO 3 :: B$(A)=B$(A)&CHR$(I+D) :: NEXT D :: NEXT I

140 DISPLAY AT(16,1):RPT$(B$(1),7);RPT$(CHR$(128),224) :: A=0

150 FOR I=1 TO 8 :: B$(I)=SEG$(B$(I),2,3)&SEG$(B$(I),1,1) :: A=A+1 :: C$(A)=RPT$(B$(I),7) :: IF A=32 THEN 170

160 NEXT I :: GOTO 150

170 FOR I=1 TO 32 :: DISPLAY AT(16,1):C$(I) :: NEXT I :: GOTO 170

180 DATA 0000001D3F7FFFFF002078FDFFFFFFFF000E3FFFFFFFFFFF0000C0E0F0FEFFFF,0000003B7FFFFFFF0040F0FBFFFFFFFF001C7FFFFFFFFFFF000080C0E0FCFFFF

190 DATA 00000177FFFFFFFF0080E0F7FFFFFFFF0038FFFFFFFFFFFF00000080C0F9FFFF,000103EFFFFFFFFF0000C1EFFFFFFFFF0070FEFFFFFFFFFF0000000081F3FFFF

200 DATA 000207DFFFFFFFFF000083DFFFFFFFFF00E0FCFEFFFFFFFF0000000103E7FFFF,00040FBFFFFFFFFF000107BFFFFFFFFF00C0F8FCFEFFFFFF0000000307CFFFFF

210 DATA 00081E7FFFFFFFFF00030F7FFFFFFFFF0080F0F8FCFFFFFF000000070F9FFFFF,00103CFEFFFFFFFF00071FFFFFFFFFFF0000E0F0F8FFFFFF0000000E1F3FFFFF

Edited by Bones-69
Link to comment
Share on other sites

The circle demo is very cool :cool:

 

Could imagine using it for something similar as seen in the below WIP MSX1 shooter "Core Crisis". Look starting at 1:10 min :)

 

http://www.youtube.com/watch?v=Rzz4ZNc675Y

 

edit: I'd love to add a "special effects" library to spectra2 once I have the basic functionality rolling.

I'm hoping I get the permission to use the circle routine and some of Karsten's routines :)

Edited by retroclouds
Link to comment
Share on other sites

Awww come on retroclouds... You know you wanna use my color cycling (post 19). :) hehehehe.... Just kidding.

 

@adamantyr... That circles demo is pretty awesome. You say this is to be a special effect in "Realms?". That will be pretty wicked man. :) I love battle graphic animations, specifically on old systems. :thumbsup:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...