![]() Display the sprite at the position xpos, yposĪnimation1.display(xpos-animation1.getWidth()/2, ypos) Īnimation2.display(xpos-animation1. Image: Mandel Ngan/AFP via Getty Images If the latest impeachment push continues to backfire, Democrats can thank their duplicitous House Intelligence chairman, Adam Schiff. Animation animation1, animation2 Īnimation1 = new Animation("PT_Shifty_", 38) Īnimation2 = new Animation("PT_Teddy_", 60) Here is an example of what your code might look like if you take this approach: //use an array to hold your spritesįor (int i = 0 i Examples. Load all of them from the setup() function, and then just change which index of the ArrayList you're drawing to change the sprite. You might want to create an array or an ArrayList of PImages, each loaded with a single sprite. I see that you've already fixed your problem, but I'm going to answer with something that might make your life a little easier: don't call the loadImage() function from the draw() function! Call it from the setup() function instead.Ĭalling the loadImage() function from draw() causes your images to be loaded over and over again, 60 times per second, so it's really wasteful. ![]() This would be ok if it wasnt for processing taking about 20 frames to load in an image so its impossible for me to get a smooth walking speed. If (WalkingCounter = 1 * WalkingSpeed) īody = Body.get(X, Y, WidthSpacing, HeightSpacing) PImage Body īody = loadImage("\\Sprites\\Player\\Male\\Default\\Light.png") ![]() Its got 8 different walking positions and it seems everytime it changes i have to load that sprite sheet again as apose to just cropping the original if you get what i mean otherwise it wont show. The title might be a little confusing but im trying to get a walking animation going from a sprite sheet. ![]()
0 Comments
Leave a Reply. |