Page 1 of 1
Image rotation
Posted:
Sun May 10, 2009 7:33 pm
by naoh
How I can do that Image will be rotated in a actor direction?
Sorry for comparing, but in GameMaker it was something like that: draw_sprite_ext(spr,subimg,x,y,xscale,yscale,roatation,col,alpha).
Re: Image rotation
Posted:
Sun May 10, 2009 7:57 pm
by skydereign
To do rotations, you need a rotated sprite. You can't rotate an actor, but it is possible to make the actor look like it is rotating. You can manipulate the angle of the actor, and with a fully rotated sprite, set the animation position to the right degree. Essentially it is rotating, as directional velocity will also change.
Re: Image rotation
Posted:
Sun May 10, 2009 8:21 pm
by naoh
But what when I want to make an animated actor? I will have 1 frame of stand animation and 10 frames of walk animation, so I have to make 3960 frames?
Re: Image rotation
Posted:
Sun May 10, 2009 11:21 pm
by BlarghNRawr
unless you walk using the mouse, there should only be 80 frames and u only have to draw 20 because the rest can just be rotated in paint
because you dont need to be walking to every possible degree, unless ur walking using mouse clicks like i said before, but even then u should only need to draw some for every 10 degrees or so
Re: Image rotation
Posted:
Mon May 11, 2009 4:09 pm
by Hblade
You could edit the game editors source code to make a way to rotate objects within game editor. Game editor runs off C, right? Your games, there made in C.... Now, if you could have the C programming code read a custom DLL file, thats within the game editor's file / directory, you could use C++ to make a DLL file that interacts with Game Editor then you can use that to rotate your images inside of game editor, but for anyone else that dosn't have that DLL file, the game might crash, or simply the image won't rotate. BUT, if you use some kind of install program, you can use the DLL file for everyone who downloads your game. Thats the only way I can think of rotating any images within game editor for now.
Re: Image rotation
Posted:
Thu May 14, 2009 10:22 am
by naoh
I have another problem.
How do something like this?:
If dierction is larger than 0 but smaller then90 change animation to ani1
If direction is larger than 90 but smaller than 180 change animation to ani2
If direction is larger than 180 but smaller than 270 change animation to ani3
If direction is larger than 270 but smaller than 360 change animation to ani4
I tried to do this that way:
Add>Draw Actor>Script editor
- Code: Select all
if(angle>0)
{
ChangeAnimation("Event Actor", "ghoul1", FORWARD);
}
if(angle>90)
{
ChangeAnimation("Event Actor", "ghoul2", FORWARD);
}
if(angle>180)
{
ChangeAnimation("Event Actor", "ghoul3", FORWARD);
}
if(angle>270)
{
ChangeAnimation("Event Actor", "ghoul4", FORWARD);
}
But it changes animation every step and it finally shows only first frame of animation. How I can do this better way?
Re: Image rotation
Posted:
Thu May 14, 2009 10:26 am
by skydereign
Just for consistency, I would set the ifs after the initial to else if. But, instead of FORWARD in the change animation, use NO_CHANGE. That should work, though is that really the method you want to use? That limits the amount of animations the actor will have to 4 unless you use variables to limit it also.
So you know, if you wanted to do greater and smaller it would be like this, but the way you structured it works, though has a chance of flickering.
- Code: Select all
if(angle>0 && angle<90)
{
ChangeAnimation
}
Re: Image rotation
Posted:
Thu May 14, 2009 3:28 pm
by naoh
Thanks alot. Final version I'll will use looks that:
- Code: Select all
if(angle>338 && angle<360)
{
ChangeAnimation("Event Actor", "0", NO_CHANGE);
}
if(angle>0 && angle<22)
{
ChangeAnimation("Event Actor", "0", NO_CHANGE);
}
if(angle>22 && angle<67)
{
ChangeAnimation("Event Actor", "45", NO_CHANGE);
}
if(angle>67 && angle<112)
{
ChangeAnimation("Event Actor", "90", NO_CHANGE);
}
if(angle>112 && angle<158)
{
ChangeAnimation("Event Actor", "135", NO_CHANGE);
}
if(angle>158 && angle<202)
{
ChangeAnimation("Event Actor", "180", NO_CHANGE);
}
if(angle>202 && angle<247)
{
ChangeAnimation("Event Actor", "255", NO_CHANGE);
}
if(angle>247 && angle<292)
{
ChangeAnimation("Event Actor", "270", NO_CHANGE);
}
if(angle>292 && angle<338)
{
ChangeAnimation("Event Actor", "315", NO_CHANGE);
}