|
|
#1 |
|
Junior Member
Join Date: Oct 2007
Posts: 34
|
Sprite movement howto?
Hi,
Sorry if this is in the wrong place: it doesn't seem to me to fit properly into any of the subforums. I also apologise in advance if this has been answered before: if it has I've been unable to find it via the forum FAQs, search or google ![]() Looking at the discussions in the preset forum my problem is extremely basic, but that's where I am at the moment - I only discovered winamp visualizations a week ago and I've done no maths since high school, back in the mesozoic era. I've made a few sprites of my own - very basic items to "drift across the screen every so often" and installed them using the examples in the default milk2_img.ini file. I've made several successful modifications to the example files for things like sprite size, blendmode and direction of rotation, now I'm stuck on changing the direction it moves. The example file I'm trying to modify is this one: [img04] desc="cool: an 'osapien' drifts across the screen every so often." img=textures\smalltiled_electric_nebula.jpg init_1=blendmode = 3; init_2=x = -100; init_3=orig_y = 0.5; code_1=time_to_reset = below(x,-0.5); code_2=x = x*(1-time_to_reset) + time_to_reset*(1.5 + 0.01*rand(100) + 3); code_3=orig_y = orig_y*(1-time_to_reset) + time_to_reset*(0.3 + 0.4*0.01*rand(100)); code_4=sx = sx*(1-time_to_reset) + time_to_reset*(0.25 + 0.4*0.01*rand(100)); code_5=sy = sx; code_6=x = x - 0.008 + 0.0033*sin(time*1.371); code_7=y = orig_y + 0.12*sin(time*1.9); the resulting sprite drifts across the preset from right to left. I've got one that does that, now I'd like to change it so the sprite drifts across from left to right. It's not covered in milkdrop.html and milkdrop_preset_authoring.html is beyond me. I'd guess it's somewhere in the x values so I played around with a few things more or less at random (switching + for - and vice versa, cos for sin, moving the 1- around) which either did nothing or stopped the sprite appearing at all. ![]() So could someone please tell me how to get the sprite in the above example to drift from left to right? and / or point me at an entry level howto? Thanks in advance ![]() C |
|
|
|
|
|
#2 | |||
|
Junior Member
Join Date: Oct 2007
Posts: 34
|
A friend who's a programmer took a look at this for me and came up with a couple of solutions:
Quote:
There is another way of doing it, which in the original example is frequent and regular but gives you an easy way of fiddling with the variables: Quote:
[img03] desc="cool: a dragon drifts across the screen every so often." - left to right img=sprites\dragon.tga colorkey=0xFFFFFF init_1=blendmode = 4; init_2=x = -100; init_3=orig_y = 0.5; code_1=time_to_reset = below(x,-0.5); code_2=x = x*(1-time_to_reset) + time_to_reset*(1.5 + 0.01*rand(100) + 3); code_3=orig_y = orig_y*(1-time_to_reset) + time_to_reset*(0.3 + 0.4*0.01*rand(100)); code_4=sx = 0.2; code_5=sy = 0.2; code_6=x = x - 0.008 + 0.0033*sin(time*1.371); code_7=y = orig_y + 0.12*cos(time*1.9); code_8=done=above(frame,2000); Another option would be Quote:
|
|||
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|