sprite

How do I add a line as a sprite in pygame?

拟墨画扇 提交于 2019-12-23 20:18:47
问题 I want to add a grid to my level that stays with the terrain and not the screen. The way I thought of doing it is to add all the lines that form the grid as sprites and move them with the terrain, but I can't figure out how to represent the line as an image. I tried to do this myself, but had no success. EDIT: Here's what I've tried class Grid(): def __init__(self): self.grid = pygame.Surface(size) self.grid.set_colorkey((0,0,0)) def draw(self): # DRAW TILE LINES -----------------------------

Three.js: Distant objects are faint

限于喜欢 提交于 2019-12-23 16:34:12
问题 I'm working on a three.js scene that renders some textured point sprites. Those sprites get their textures from a single uniform , and that uniform is a 2D canvas on which I've drawn the letters of the alphabet: While all the letters are rendered on this canvas in black, points in the three.js scene that are far from the camera appear quite faintly in my scene: // aliases var BA = THREE.BufferAttribute, IBA = THREE.InstancedBufferAttribute, ARR = Float32Array; function Wordmap() { // config

how do i determine a sprite's position in pygame?

扶醉桌前 提交于 2019-12-23 05:22:09
问题 I'm new to pygame and am making a zombie running game. I am controlling the human with the arrow keys and I would like to have a zombie run toward the player's position when the zombie is first created. I am unsure how to determine the players position to set the zombie in the correct direction. The zombie doesn't have to follow the human, just head in the direction of the players position when the zombie is created. class Human(pygame.sprite.Sprite): def __init__(self): pygame.sprite.Sprite.

Can't load sprite in AndEngine

给你一囗甜甜゛ 提交于 2019-12-23 04:18:09
问题 I'm learning AndEngine and I'm following some basic tutorials. I tried to load an sprite in the screen, but the Sprite looks corrupted. This is my code: package com.example.andengine_demo; import org.andengine.engine.camera.Camera; import org.andengine.engine.options.EngineOptions; import org.andengine.engine.options.ScreenOrientation; import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy; import org.andengine.entity.scene.Scene; import org.andengine.entity.scene

game programming in C#: sprite collision

最后都变了- 提交于 2019-12-23 04:03:19
问题 I have a C# snippet code about sprite collision in C# game programming, hope you guys will help me to clarify it. I dont understand method IsCollided, especially the calculation of d1 and d2 to determine whether the sprites collide or not, the meaning and the use of Matrix Invert() and Multiphy in this case as well as the use of Color alpha component to determine the collision of 2 sprites. Thank you very much. public struct Vector { public double X; public double Y; public Vector(double x,

Automatically find frame sizes from png sprite sheet [duplicate]

一世执手 提交于 2019-12-22 18:31:58
问题 This question already has an answer here : Closed 6 years ago . Possible Duplicate: PySide: Separating a spritesheet / Separating an image into contiguous regions of color Given a .png image with transparent pixels and a grid of individual animation frames (where the last row need not be full), how would you automatically find the dimensions of each individual frame, and detect how many frames are in the .png? I am trying to convert the resources from the creative-commons treasure-trove of

Cocos2d, iOS: what is the correct way to remove sprites from cache?

*爱你&永不变心* 提交于 2019-12-22 14:57:08
问题 I got a GameScene class that is not a singleton instance. Hence I allocate and deallocate it every time the user chooses a new level and keep the "static"/"shared" data in a different singleton class (E.g. GameManager). I am using ARC . I would like to understand if my approach is correct under the memory management point of view. In other words, is it enough to call "removeUnusedSpriteFrames" at cleanup? Will this remove all sprites in game-art-forLevelOne-hd.plist? Should I do something

XNA Game, Full Screen Animation / Video Playback

此生再无相见时 提交于 2019-12-22 11:37:36
问题 I have an XNA game (its a slot machine). I have some really cool animations my artist made for me that are more or less 1600x1000 and over 50 frames. For all of the animations so far I have been using sprite sheets. (Where all the frames are in one image file and when its rendered it chooses what part of the image to show). The problem is that you can only load an image of a certain size. 2kx2k or 4kx4k depending on your videocard. Obviously putting each frame into one file is out of the

Do OpenGL Point Sprites work in Android?

邮差的信 提交于 2019-12-22 08:27:29
问题 I'm developing on a Droid, version 2.1-update1. My supported GL extensions include GL_OES_point_sprite and GL_OES_point_size_array. I am unable to get point sprites to render. The code below throws UnsupportedOperationException from GLWrapperBase at the glTexEnvi call. If I disable textures and comment out the glTexEnvi all, it throws the same exception further down, at glPointSizePointerOES(). Are point sprites properly supported in Android? Has anyone gotten them working? Or is there an

How to set the background image for a SKScene?

白昼怎懂夜的黑 提交于 2019-12-22 08:27:15
问题 Since currently it is not possible to set the color to of a SKScene to clearColor , by doing -(id)initWithSize:(CGSize)size { if (self = [super initWithSize:size]) { self.backgroundColor = [SKColor clearColor]; } return self; } As seen here: LINK Then how can one set the background image for a SKScene ? Please be as specific as possible, sample code would be great! 回答1: Use an SKSpriteNode centered in the scene: -(id)initWithSize:(CGSize)size { if (self = [super initWithSize:size]) { //