NITWIT

Members
  • Content count

    9
  • Joined

  • Last visited

  1. Proper way to animate sprites

    Thanks Ivan, I'll dig into these links tomorrow when I get a minute. If anyone else wants to share, I'd love to hear how all you people animate your sprites.
  2. Proper way to animate sprites

    I'm wondering what the best way to animate a sprite is. Is there a basic example or tutorial out there somewhere? I have ten images in a spritesheet that are part of an idling animation, and I made a texture for each of the images. I put the textures in an array, and my plan is to just change the texture of my sprite each frame in the gameloop, looping through the array of textures over and over again. Maybe using Sprite.setTexture ??? Is that a good way to go about it? Any links to info or tutorials would be much appreciated. Thanks,
  3. Best way to make the camera follow a sprite?

    Just wanted to say thanks! I messed around with your code snippet and got it working.
  4. Zoom and Drag

    I'm a newb, so don't listen to me. But I'd try attaching your mouse event handlers to bunnies.bunny instead of just bunny? Maybe the mouse events aren't triggering because it's just hitting the container instead of the bunny sprite.
  5. I want to make the camera follow my sprite around. (so my sprite is always in the center of the screen) What's the best way to go about this? Does Pixi have built-in camera functions? I thought about just moving everything else relative to my sprite, but I thought this wouldn't be the best way. I googled around a bit, but with no luck. Any tips or resources would be much appreciated. Thanks.
  6. stage.removeChild() not working as expected

    Ahhh I see. I didn't realize the object would still be there after I removed the sprite. That's good to know. Thanks!
  7. stage.removeChild() not working as expected

    .Thanks Ivan, I know my code is a mess. I'll clean it up and I imagine that will fix a lot of bugs. To be clear, I don't think there's a bug with Pixi -- it's definitely on my end. I guess I'm just wondering what the removeChild() function does exactly. For example, If I create a sprite and give it an x position. mySprite.x =100; And then I remove the sprite. stage.removeChild(mySprite); And then I ask for mySprite's x position. console.log(mySprite.x); Would the browser still know the x position? Would it print 100 to the console? or undefined maybe? Does the browser keep data about a sprite even after you remove it? Sorry if these are really dumb questions. Maybe there's a Pixi newb section I should post to instead. Thanks!
  8. Hi, I'm just getting started with Pixi. I made a little sprite that walks around and shoots things. Whenever I bump my sprite into the bad guys, I want him to disappear. So I ran stage.removeChild(mySprite) and he disappeared! But... He still shoots when I click and he still moves around with WASD. So it just makes the sprite invisible? Here's a link: http://www.med.wadholm.com/Kaitlyn/sprites/pixi/bunny/
  9. Collision detection

    Maybe check this out too. It's more on the hitTestRectangle() function. https://github.com/kittykatattack/bump