With Icon.Turn it looked ugly!! I sweaaar!~
Why u all bad people? -(Except Jittai! xD)
In response to Jittai
I'm pretty sure v500's transform feature didn't affect the icon procs at all. My rotated icons have always looked like this. If you want pre-500 stuff, you can try shooting some bows and arrows in Hazordhu and see that there's no difference.

Another thing about the icon procs, you can't (afaik) save the transform'd icon. If you saved the Turn()'d blue arrow's icon at any angle, it would look exactly as it does on the map. However, since atom.transform is rendered by the client, the icon is not affected.

If you want to try it out yourself on any version, here's the full source (minus the icons):
world
fps = 60
maxx = 2

turf
icon = 'red.dmi'

mob
verb/start()
var turn_rate = 1

var obj/a = new (locate(1, 1, 1))
var a_angle = 0
a.icon = 'arrow.dmi'
spawn for()
a_angle += turn_rate
var icon/i = icon('arrow.dmi')
i.Scale(64, 64)
i.Turn(a_angle)
i.Scale(32, 32)
a.icon = i
sleep world.tick_lag

#if DM_VERSION >= 500
var obj/b = new (locate(2, 1, 1))
var b_angle = 0
b.icon = 'arrow.dmi'
spawn for()
b_angle += turn_rate
b.transform = matrix(b_angle, MATRIX_ROTATE)
sleep world.tick_lag
#endif

Downgraded to 499 something.
Titled the gif to "OH GOD PLEASE HELP".
Ok so Kaio was in fact slightly right, if you remake the icon each time and not reuse the icon like I was it does not become obliterated but it does not look as good as it does now.
In response to Jittai
smurff jizz.

Jittai, you've got some explaining to do.
now make a minimap
Kaio's argument was just that all of these things could be done pre-500, just way less viably at times. I guess? (feel free to step in Kaio)

In the end it's kind of a moot argument though.
Pre-500, the only difference in icon.Turn() was that it didn't allow fractional angles; it should now. However for those who still would like to use this feature, I'd definitely prefer to replace the current rotation with something like RotSprite. Sadly I haven't seen any code for a RotSprite implementation, and would have to attempt it from scratch. Hence it's something I haven't really done yet.
In response to Lummox JR
Lummox JR wrote:
Sadly I haven't seen any code for a RotSprite implementation, and would have to attempt it from scratch.

I don't know if this helps, but I looked and found this one right away. The source is provided, and it also just so happens that it's written in C. I haven't tested, so I don't really know if it does what is claimed.

Anyway, RotSprite looks like it transforms pixel art really well, compared to other methods I have seen. It makes me wonder why so many pixel art programs don't include it.
In response to Multiverse7
That code doesn't do its own rotation; it's only doing the scaling part of the problem. It's fobbing off actual rotation onto an SDL helper library that's known to suck.

RotSprite divides into four parts:

1) Scale up the icon using an algorithm designed for scaling up pixel art.
2) Rotate using nearest-neighbor interpolation.
3) Scale down using nearest-neighbor interpolation.
4) Restore small features that were lost in the rotation.

That code doesn't do #2 on its own and doesn't appear to do #4 at all.
That's mainly how I got nice quality rotation with Turn() before v500. I was upscaling the icon to 4x, then I'd rotate, then scale down to original size. The reason why is because it seemed that, 499 and earlier Turn() would not attempt to anti-alias, where Scale() would. So you scale up, then rotate, then scale down, and in the process of scaling down it would anti-alias the icon, not only that but the process of rotating it at a larger scale meant that there was more resolution to work with, so slight edges didn't look as muffed up when turned at a smaller icon size.

It was a better result than just using Turn() by itself, bit it was quite the load on CPU (depending on the size of the icon).

In response to Bravo1
Well, yeah. You can see that much in the code I posted for the spinning arrows.
In response to Kaiochao
Just stating my personal experience.

This was mine. It uses alpha, animate(), and transform for the projectiles. The gif recorder was laggy during recording, but otherwise it's pretty good.
In response to Pokemonred200
In response to Vrocaan
Vrocaan wrote:
http://www.cockos.com/licecap/

Thanks. Post now updated w/ new gif.
In response to Enic
Can you show how you did this? thanks!
In response to FIREking
FIREking wrote:
Can you show how you did this? thanks!

Because just showing code wouldn't really tell you much about how it works, so I'll try to do my best explain it in words :3

For the trail effect, I made a loop on the move function that spawns objects with the icon and animate the pixel_x/y to random directions and fades with alpha, nothing too weird there :3

For the bump effect however, has a bit math to it. I take the angle of the direction the projectile is moving, and subtract it with 90 degrees to get the starting degree of where the first effect should be directed towards, I call this variable nangle (for new angle). Then I calculate how many degrees the effects should have to be apart from each other by dividing 180 with the amount of effects subtracted with 1. Example: 180/(am-1), am being the amount of effects, I save that value in a variable i call add. I'm subtracting it with one so the last value will be 180 degrees away in the loop.

And now I created a for loop that loops as many times as the amount variable.
for(var/i = 0;i<am;i++)
..

The first thing I do in the loop is to calculate the positions of where the effects end position will be. I do this by sin and cos.
var x = sin(nangle-(i*add))*30
var y = cos(nangle-(i*add))*30

I then multiply it with 30 to calculate how far away the position will be. Multiplying with 30 will be about 30 pixels away.

And now I finally use the animate() proc to animate the pixel_x/y variables, transformation to a lower size and the alpha. I then do a spawn() process to delete the object after how long the animation is.

And that's pretty much it. I hope I'm not too confusing and that the text actually made sense :P
In response to Enic
Actually, I probably would have understood it better from code haha.

I think I get the gist of what you're saying, but I'm trying to figure out how to do it with least amount of server CPU involved. Make the animate do most of the work.
In response to FIREking
How do I upload an animated gif like the ones above? I might have your answer FireKing:

var
angle = 0
while(true)

animate(src, transform = turn(matrix(), angle), loop = -1, time = 2)
angle += 30
sleep(1)
if(angle >= 360)
angle = 0


This works for making it rotate, it doesn't rotate very quickly, but It also seems to be pulsating which is odd.
Page: 1 2 3 ... 14 15 16 17 18 19