Jump to content

CyanPrime

Members
  • Posts

    9
  • Joined

  • Last visited

CyanPrime's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi, so I'm trying to figure out a way to rotate two objects at the same time. These are top down wings I want to go back and forward. When I try doing them one at a time the angles are always slightly off, so I'm hoping theres a way to grab two objects, and rotate them inward and /or outward at the same time (one going clockwise, and one counter). Is this possible, and if so - how? Thank you for your time.
  2. Thank you for the reply. I think I got it working now. I'm gunna run some more tests, streamline it a bit and then release it.
  3. Does anyone have it? I wanna try it out in my slick2d powered SCML importer.
  4. So I'm having trouble calculating my drawn part's angles. I'm doing it the same way the guide said to, but I'm still getting bad results (It spins way too much). I'm using slick2d, and Java. The slick2d Image.rotate(angle) function seems to take degrees and not radians, so I don't think that's the problem. Under the code I'll post my CSML file so everyone can see the what I'm working with. (Maybe I should post the images in a zip too?) Alright, so this is my drawing method (or function for those who prefer C terms) EDIT: sorry, it only posts all green, so it's kinda hard to read. Just copy the text into notepad++ and set the lang to Java or open it in a java editor. There's really nothing I can do about the color. public void draw(Vector2f pos){ //recieves a point to draw the sprite on the screen at for(int i = 0; i < myAnim.timelines.size(); i++){ // loop around the current animation's timelines for(int j = 0; j < myAnim.timelines.get(i).keys.get(currentFrame).keyObjects.size(); j++){ // loop around the current timeline's key's (based on the current key/frame) objects (parts to draw) KeyFrame prevFrame = myAnim.timelines.get(i).keys.get(0); //this is a one frame animation, so the previous frame is always 0 (Cause I'm only trying to go from 0 to one right now) KeyFrame keyFrame = myAnim.timelines.get(i).keys.get(currentFrame); // current frame can eather be 1 or 0 (0 to see the basic stance, and 1 to see the animation) KeyObj startObj = prevFrame.keyObjects.get(j); //the previous frame's object (part to draw) KeyObj obj = keyFrame.keyObjects.get(j); // the current frames object (part to draw) Image img = images.get(imgNum[obj.folder][obj.file]).img.copy(); // copy the image needed to be drawn float offX = obj.offset.x; //set the final X offset value to the object's offset value if the current frame is 0 float offY = obj.offset.y; //set the final Y offset value to the object's offset value if the current frame is 0 float angle = obj.angle; //set the final Angle offset value to the object's offset value if the current frame is 0 if(currentFrame != 0){ //don't do any of this if the current frame is 0 boolean subB = false; //boolean to control wether to subtract 360 from the current object's angle in the following equasion boolean addB = false; //boolean to control wether to add 360 to the current object's angle in the following equasion if(obj.angle - startObj.angle < 0 && keyFrame.spin == 1) addB = true; // if the current object's angle minus the last frame's object's angle is negitive and the keyframe's spin variable is 1 add 360 to the current object's angle in the following equasion if(obj.angle - startObj.angle > 0 && keyFrame.spin == -1) subB = true;// if the current object's angle minus the last frame's object's angle is positive and the keyframe's spin variable is -1 subtract 360 from the current object's angle in the following equasion //this is where the error is---------- //if subB is true subtract 360 from the current object's angle in this equasion if(subB) angle = startObj.angle + (((obj.angle - 360) - startObj.angle) * (currentTime - prevFrame.time) / (keyFrame.time - prevFrame.time)); //if addB is true add 360 to the current object's angle in the equasion else if(addB) angle = startObj.angle + (((obj.angle + 360) - startObj.angle) * (currentTime - prevFrame.time) / (keyFrame.time - prevFrame.time)); //if nether are true do nothing to the current object's angle in the equasion else angle = startObj.angle + ((obj.angle - startObj.angle) * (currentTime - prevFrame.time) / (keyFrame.time - prevFrame.time)); //error end? -------------------- //X and Y going through the same equasion as angle offX = startObj.offset.x + ((obj.offset.x - startObj.offset.x) * (currentTime - prevFrame.time) / (keyFrame.time - prevFrame.time)); offY = startObj.offset.y + ((obj.offset.y - startObj.offset.y) * (currentTime - prevFrame.time) / (keyFrame.time - prevFrame.time)); } //if the current keyframe's spin value is -1 rotate counter clockwise if(keyFrame.spin == -1){ System.out.println(currentTime + " " + angle); img.rotate(-angle); } //else rotate clockwise else img.rotate(angle); //draw image at proper location and rotation (at least if everything worked right) img.draw(pos.x + offX, pos.y - offY); } } } <?xml version="1.0" encoding="UTF-8"?>
  5. It's kinda a needed ASAP thing, so could I at least get a reply? :
  6. "Click here to view/download the final specification document" is giving me a 404.
  7. Hello, and thank you for replying. I am saving my file in a sub-folder of Desktop. It's not a problem saving it on it's own, its when I save if after I delete a animation point (If it doesn't crash before I can). Anyway if I delete a anim point, then save, then shut off Spriter, then turn it back on, and load the save it will be without images in the Objects in Frame panel, and if I click on one of the image-less entries it will crash. The images are in the same place on both first load, save, and second load, so that's not the problem.
  8. like, it'll crash when I delete a animation key frame, then when I reload my project none of the images will be there, then when I click on one of them in the Objects in Frame panel it crashes again. I literally can't go more then 1 minute without it crashing. I hope to preorder it next month, but if this can't be fixed I'll have no choice but to pass. PS, I'm on Win 7 x64. Tried running it in XP mode, and it did the same thing.
×
×
  • Create New...