Sprite patterns

Previous topic - Next topic

Brick Redux

The code below displays patterns using zoomedsprites.  Might be halpful with demos or something as a few weeks back I was watching some progs created on the old ORIC computer.  One was a tunnel effect and it quickly came to me that my first attempt at swarming sprites (aka a galaxian/spacehawk Im coding) could duplicate this.  Its wierd how your coding always seems to tie into something else and the next day after a long sleep you nail the the idea and recreate a past effect.

Its just for fun. Press a key for a new pattern.

Code (glbasic) Select

SETCURRENTDIR("Media")

LOADSPRITE "bob.png",0
LOADSPRITE "bob1.png",1

that=40 ; that_too=40 ; factor=.5

WHILE TRUE

xx=320 ; yy=220 ; rx=10 ; ry=10 ; zoom=1 // Start in the centre.

FOR b=0 TO 30 // 30 times per loop.

FOR a=0 TO 359 STEP that

INC ang,that_too // This dictates the change in angle for this rotosprite.

Sprite_Path(image,xx,yy,rx,ry,ang,1,zoom)

INC image ; IF image>1 THEN image=0 // Flip between sprite 0 and 1.

NEXT

INC ang,this_too // Alter the settings for the next part of the B Loop.
INC zoom,factor
INC rx,b*2
INC ry,b*2

NEXT

SHOWSCREEN

KEYWAIT

that=RND(100) // Create a new pattern with random settings.
that_too=RND(100)

WEND

/// Early curbed path function i coded . It can roto move a sprite around an oval shape but isnt perfect. 
/// Created originally to display a galaxian swarm type affect for my current project.  Have found its
/// better to use DrawSprite and follow a DATA path when moving swarms - then jump them into their x/y
/// positions smoothly.
/// It can be used though to create "crummy" looking tunnel/vortex displays - hence this post.

/// Sprite_Path : sprite image, xpos,ypos,radiusx,radiusy,angle,direction,zoomsize

FUNCTION Sprite_Path: im%,x%,y%,rx%,ry%,deg%,dir%,size%

SMOOTHSHADING FALSE

IF dir>0

ROTOZOOMSPRITE im,rx * -SIN(deg) + x, ry * -COS(deg) + y, deg,size

INC deg

ELSEIF dir=-1

ROTOZOOMSPRITE im,rx * SIN(deg) + x, ry * COS(deg) + y, deg,size

DEC deg

ENDIF

ENDFUNCTION




Add the sprites to your media folder.

Enjoy.
A mournful owner of a HP HDX18 Laptop that has died...FECK!

Brick Redux

A mournful owner of a HP HDX18 Laptop that has died...FECK!

Brick Redux

A mournful owner of a HP HDX18 Laptop that has died...FECK!

Brick Redux

A mournful owner of a HP HDX18 Laptop that has died...FECK!

mentalthink

This it's really cool, I think for demos or something linked whit music can be intersting, make a videoDJ or for audio-artist program whit this and put into a projector can be very cool, something like a program open source named ...(I can find it, sorry).

Something changing the Audio and realtime images syncronized.

Over 3D objects perhaps can works well... if the code it's very quickly, perhaps changing in realtime the surface don't need too much CPU?¿...  :O

THKS  :good:

Ian Price

These are pretty simple effects but the results do look very good. 

Very nice, especially this one

:)
I came. I saw. I played.

Schranz0r

Brick,

your avatar an the pictures on right... GODLIKE!  :good:
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Brick Redux

Bless you my.....ARSE , GIRRLS, FECK, DRINK!....DRINK!....DRI....
A mournful owner of a HP HDX18 Laptop that has died...FECK!