Questions tagged [sprite]

A sprite is a two-dimensional image or animation that is integrated into a larger scene.

Sprite

A sprite is a two-dimensional image or animation that is integrated into a larger scene.

Spriting

The term is also used when taking subsections of a larger image file containing icons for display. This allows browsers to load only one image file and reuse it to display many icons by using offsets. This is known as spriting.

FAQs

Resources

4792 questions
1
vote
1 answer

Issues with sprites and images. The sprites method .draw() doesn't work for some reason

I am getting the following error. TypeError: argument 1 must be pygame.Surface, not str I have been looking at how I am formatting images and nothing seems to be wrong. Anyways here is my code: import pygame from random import…
Addison
  • 403
  • 8
  • 24
1
vote
1 answer

Forbid some div with class accurate for moving

I created a turn-based javascript game.For moving the players I use jQuery. I'm moving a sprite inside my game board which consists of 100 squares with board-0 ids to board-99. I'm moving my sprite from id to id. Everything works perfectly, but I…
user9134157
1
vote
2 answers

How to make a variable output 'True' when two images collide in pygame

I am currently making a top down racing game and need a way to detect when a vehicle has completed a full lap. I have chosen to do this by adding images around the circuit, acting as checkpoints, which match with the track surface. When driven over,…
RossC
  • 101
  • 2
  • 8
1
vote
0 answers

Using the Sprite class for Animation in LibGDX

I'm making a simple game in LibGDX. I want to use the Sprite classes methods for my main player, while using the Animation class in order to animate the player as well. I've gotten Animation to work, I just haven't been able to integrate it with the…
1
vote
1 answer

Acting on all sprites from the add new sprite method cocos2d xcode

I am building a game for iphone, I am new to game devolopment and somewhat new to the language. I have balls that fall from the top of the screen to the bottom and the player is supposed to try and catch them. The problem is, I add the new sprites…
1
vote
1 answer

Wall sprite not showing up on screen after certain coordinates in pygame

Trying to make collision detection as means to make sprites bounce off one another, but my wall sprites aren't showing up after coords (5, 5) I wasn't sure if maybe it had to do with fill and colorkey both being white, or the fact that…
ajjanna12
  • 25
  • 3
1
vote
1 answer

Finding Sprites in pygame

I am attempting to make a 2D game in Pygame. Later I will convert it to kivy to deploy to mobile devices. I have searched many tutorials to get started, and I understand the basics of sprites/physics. However, I cannot find a tutorial that tells me…
Simeon Ikudabo
  • 2,152
  • 1
  • 10
  • 27
1
vote
1 answer

PygameSprites moving off screen even with function setting parameters not to

So I have a function that keeps the sprite from moving off screen which is:` def move_extent(self, x, y): if self.rect.right > 700: self.rect.right = 700 elif self.rect.left < 0: self.rect.left = 0 elif self.rect.y < 275: …
ajjanna12
  • 25
  • 3
1
vote
1 answer

Moving Sprite automatically libGDX

I'm trying to move a sprite in libGDX by using a method, that is changing its x and y coordinates every time it is called (it's supposed to be an "animation" for a card game). if (card.isAnimated()) { …
1
vote
1 answer

Pygame collision detection not working with rotated image

I don't understand why the sprite collision detection is not taking the image rotation into account. I tried different functions but they didn't work out for me. CarSprites.py: import pygame, math, random class CarSprite(pygame.sprite.Sprite): …
NickGames
  • 312
  • 1
  • 18
1
vote
0 answers

Phaser Sprite.world.x gives 0

I am using Phaser CE 2.9.4 (I experienced the same issue in 2.6.4) So my problem is that I have a sprite that is giving me 0 for sprite.world.x and sprite.world.y (although it clearly isn't at 0,0). What's weird is that printing out the…
SamJ
  • 413
  • 1
  • 4
  • 18
1
vote
0 answers

Svg sprite icons showing line or artifact on my application

Can anybody help with sprite icons, something wired line or artifact is showing on icons and when i give shape and spacing (padding 1) for sprite icons the icons totally disappears and if i give shape and spacing (padding 0.5) i can see icons but…
1
vote
0 answers

CGRect SKSpriteNode and game coordinates

I am setting up a game using sprite kit. I want to make sure a dragable node called background ( skspritenode size 2000 x 2000) stays visible on the screen without showing the edges. So if the screen is represented by one CGRect called screenRect…
carl
  • 121
  • 1
  • 8
1
vote
1 answer

Collision is not working Bullet vs Mob

I've tried numerous things to let my bullets collide with my mob, but it doesn't work. The bullet just goes straight through the mob. I also tried spritecollide and groupcollide codes, but they all failed. Maybe i'm putting my code in the wrong line…
Ectrizz
  • 139
  • 2
  • 10
1
vote
1 answer

Moving a sprite while it is moving pygame

The problem I am facing is that I have an enemy sprite that is walking on a predetermined path and he needs to keep doing that, but when I press a button he needs to move to the right for example but he still needs to move on the predetermined path.…
Geordyd
  • 165
  • 2
  • 10