Old 22nd December 2011, 02:06   #1
LlamaLlamaLamp
Junior Member
 
Join Date: Feb 2011
Location: Australia
Posts: 40
Space Invaders Math

Hello math geniuses!

I'm assuming this isn't possible but I thought I'd ask anyways.

I want to display a sprite of a space invader in MilkDrop (using the milk2_img.ini file) and have it move like a space invader does. I.e. starts at x,y jumps to another position on the x axis, jumps again and then (if possible) jumps to a position on y below it. Rinse and repeat.

Possible?

Cheers
LlamaLlamaLamp is offline   Reply With Quote
Old 22nd December 2011, 14:57   #2
blastofftek
Member
 
Join Date: Apr 2009
Location: Under your bed
Posts: 51
Of course it's possible! Just think that I'm now trying to make a cheap preset in milkdrop that looks like super mario, without even using sprites.
For the thing you want to do... I'm not sure about milk2_img.ini (I've never used sprites), but to move the sprite around you can use shaders.

Some simple ideas to help you around: update your preset's shader to the next version (i.e. v 2), Go into the preset's warp shader and press F9 to see some tips.
Figured them out? Great, now throw your spaceinvader.jpg picture into the textures folder (I suppose you are familiar with textures/ sprites), and go to the per-frame code. Write your code to move the thing around, by writing its x/y position in two of the q1-q32 variables, i.e. q1 and q2. Then go to the warp shader again, and write a code that says something like:
"if (q1<uv.x<q1+0.1 AND q2<uv.y<q2+0.1)
{ret=tex2d(sampler_invader,uv-float2(q1,q2)).xyz;}
else {ret=tex2d(sampler_main,uv).xyz;}" (modify this, it doesn't work)

I hope you get the point
blastofftek is offline   Reply With Quote
Old 22nd December 2011, 15:31   #3
Nitorami
Major Dude
 
Join Date: Mar 2008
Location: Erlangen
Posts: 856
The difference between sprites and what blastofftek describes is that the sprite code is separate from the preset code, hence sprites can be invoked at any time, and on top of every preset.
Just read the tutorial that comes with winamp, milkdrop.html.
Nitorami is offline   Reply With Quote
Old 22nd December 2011, 19:49   #4
blastofftek
Member
 
Join Date: Apr 2009
Location: Under your bed
Posts: 51
Whoops :O I just read the tutorial... yeah, ignore what I said if you want, it only applies for textures and presets, not sprites... sorry

PS. ...but it could still be possible.
blastofftek is offline   Reply With Quote
Old 23rd December 2011, 13:01   #5
Nitorami
Major Dude
 
Join Date: Mar 2008
Location: Erlangen
Posts: 856
I'm not critisizing you blastofftek, just wanted to point out there is a specific way to program moving sprites in MD apart from the shaders. I never used sprites, but what LlamaLlamaLamp wants should be quite easy to achieve simply via the x,y, and time variables in milk2_img.ini.
Nitorami is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Visualizations > MilkDrop > MilkDrop Presets

Tags
math, milk2_img.ini, sprite, sprites

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump