rotate actor image based on key press
echoink
Member Posts: 11
I have attempted to constrain attribute changed to various angles to no avail. The change attribute, graphics, flip horizontally, when I click the left arrow and flip horizontally when I flip the right arrow, but I can't get the graphic to turn 90 degress to the right (downward when I press the down arrow). Nor can I get it to face up when I press the up key.
When I set the down arrow to
Move in direction 270 relative to actor in an additive way
speed 300
constrain self.rotation to vectorToAngle(270,270)
constrain self.rotation to vectorToAngle(0,270)
constrain self.rotation to vectorToAngle(270,0)
the actor moves at a 45 degree downward angle and the graphic aims upward.
When I set the down arrow to
Move in direction 270 relative to actor in an additive way
speed 300
constrain self.rotation to vectorToAngle(270,270)
constrain self.rotation to vectorToAngle(0,270)
constrain self.rotation to vectorToAngle(270,0)
the actor moves at a 45 degree downward angle and the graphic aims upward.
Comments
AppTaco LLC
http://www.apptacostudio.com/
https://www.facebook.com/apptacostudio
Need Help? Email Me | Templates | Full Game Source Code
If i have understand your question,you are trying to rotate your image.For me ,i usually rotate the image using this code:
namespace RE__Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string fileName = "c:/Sample.png";
REImage reImage = REFile.OpenImageFile(fileName);
ImageProcessing.Apply Image Rotate(reImage, 60);
REFile.SaveImageFile(reImage, "c:/reimage.png", new PNGEncoder());
}
}
It supports to rotate the image as you wish.You can have a try.
Need Help? Email Me | Templates | Full Game Source Code