Image rotation

Non-platform specific questions.

Image rotation

Postby naoh » Sun May 10, 2009 7:33 pm

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).
naoh
 
Posts: 10
Joined: Wed Jan 28, 2009 4:01 pm
Score: 2 Give a positive score

Re: Image rotation

Postby skydereign » Sun May 10, 2009 7:57 pm

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Image rotation

Postby naoh » Sun May 10, 2009 8:21 pm

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?
naoh
 
Posts: 10
Joined: Wed Jan 28, 2009 4:01 pm
Score: 2 Give a positive score

Re: Image rotation

Postby BlarghNRawr » Sun May 10, 2009 11:21 pm

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
Download Game Music
current projects:
Bold! ?% Started mechanics
Unnamed puzzle game 60% --i need a name!--
User avatar
BlarghNRawr
 
Posts: 767
Joined: Wed Jun 25, 2008 12:36 am
Location: Not using G-E anymore. Now using Source SDK.
Score: 27 Give a positive score

Re: Image rotation

Postby Hblade » Mon May 11, 2009 4:09 pm

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.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Image rotation

Postby naoh » Thu May 14, 2009 10:22 am

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?
naoh
 
Posts: 10
Joined: Wed Jan 28, 2009 4:01 pm
Score: 2 Give a positive score

Re: Image rotation

Postby skydereign » Thu May 14, 2009 10:26 am

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
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Image rotation

Postby naoh » Thu May 14, 2009 3:28 pm

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);
}

naoh
 
Posts: 10
Joined: Wed Jan 28, 2009 4:01 pm
Score: 2 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron