sprite

As3: Draw overlapping rectangles to a sprite and apply alpha

五迷三道 提交于 2019-12-20 04:18:26
问题 I need to draw independet rectangles to a sprite. But the overlapping areas will get visible if I apply alpha to my sprite (the sprite will be fade in and out): var spBox:Sprite = new Sprite(); this.addChild(spBox); spBox.graphics.beginFill(0x123456) spBox.graphics.drawRect(100, 100, 50, 50); spBox.graphics.endFill(); spBox.graphics.beginFill(0x123456) spBox.graphics.drawRect(125, 125, 50, 50); spBox.graphics.endFill(); Is there a way to compine/flatten/merge the rectangles of my sprite? I

rendering sprites using texture region andengine

廉价感情. 提交于 2019-12-20 04:07:43
问题 Note that this is my first crack at Andengine. I have been playing around with libGdx as a potential for Android game development, but it doesn't suit my needs as I want to only develop for Android and having a 3D engine doing 2D work seems like overkill. I now want to try Andengine and see if it has what I need. The biggest problem with Andengine seems to be the complex naming scheme (I am more prone to typos when engine keywords are umpteen characters long. LibGdx had a simple naming

Animate sprite with jquery

删除回忆录丶 提交于 2019-12-18 18:31:16
问题 Does anybody know the best approach to animating a sprite using jquery. There are 3 stages of an image that i need to gradually to morph on mouseover and eventually landing on the final one until mouse off. Here is the image: Thanks! 回答1: I tried something using CSS3 transition and animation (it only works on modern browser, see caniuse) you can see my example fiddle here: http://jsfiddle.net/fcalderan/hfs22/ Main benefits: No javascript required, it's 100% pure CSS; No need to load images;

CSS Sprites - not only for background images?

亡梦爱人 提交于 2019-12-18 15:17:44
问题 Is it possible to use CSS sprites for "foreground" images -- i.e. images that users are supposed to click on and interact with and maybe even print? Instead of using the CSS background-image property. What would you use? 回答1: You can use a standard <img /> tag and put it in a container (like a <div /> ) with a limited height/width. Then use relative positioning or negative margins to control the position of the image. 回答2: I have solved this problem using img tags and using the object-fit and

Remove border around sprite image in Chrome

独自空忆成欢 提交于 2019-12-18 14:12:46
问题 First time using this technique, seems that regardless what attributes I try to assign the border will not go away in Chrome. Other browsers are fine. I've tried outline:none, border:0; etc, etc. Also tried adding a colored border around the image, and noticed the the black border was still there within the colored border. Doesn't seem to want to go away. Work-around's or advice much appreciated. .share-link { display: block; width: 41px; height: 32px; text-decoration: none; background: url(

OpenGL texture atlas bleeding

依然范特西╮ 提交于 2019-12-18 13:36:01
问题 I'm trying to draw a basic 2d ground mesh made up of smaller tiles from a texture atlas (note the 1 pixel transparent border): I render the tiles as texture quads using the following code: glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2, GL_SHORT

How to scale on-screen pixels?

痴心易碎 提交于 2019-12-18 13:34:40
问题 I have written a 2D Jump&Run Engine resulting in a 320x224 (320x240) image. To maintain the old school "pixely"-feel to it, I would like to scale the resulting image by 2 or 3 or 4, according to the resolution of the user. I don't want to scale each and every sprite, but the resulting image! Thanks in advance :) 回答1: Bob's answer is correct about changing the filtering mode to TextureFilter.Point to keep things nice and pixelated. But possibly a better method than scaling each sprite (as you

Live Wallpaper Tutorial

妖精的绣舞 提交于 2019-12-18 12:42:10
问题 I am trying to do the following from a live wallpaper tutorial I found here. /** * Do the actual drawing stuff */ private void doDraw(Canvas canvas) { Bitmap b = BitmapFactory.decodeResource(context.getResources(), IMAGES[current]); canvas.drawColor(Color.BLACK); canvas.drawBitmap(b, 0, 0, null); Log.d(TAG, "Drawing finished."); } /** * Update the animation, sprites or whatever. * If there is nothing to animate set the wait * attribute of the thread to true */ private void updatePhysics() { /

Smooth Keyboard Movement in Pygame

Deadly 提交于 2019-12-18 12:36:38
问题 I'm using this code to have a player sprite move around a screen when the arrow keys are pressed: import pygame, sys, time from pygame.locals import * pygame.init() FPS=30 fpsClock=pygame.time.Clock() width=400 height=300 DISPLAYSURF=pygame.display.set_mode((width,height),0,32) pygame.display.set_caption('Animation') background=pygame.image.load('bg.png') UP='up' LEFT='left' RIGHT='right' DOWN='down' sprite=pygame.image.load('down.png') spritex=200 spritey=130 direction=DOWN pygame.mixer

Smooth Keyboard Movement in Pygame

心已入冬 提交于 2019-12-18 12:35:59
问题 I'm using this code to have a player sprite move around a screen when the arrow keys are pressed: import pygame, sys, time from pygame.locals import * pygame.init() FPS=30 fpsClock=pygame.time.Clock() width=400 height=300 DISPLAYSURF=pygame.display.set_mode((width,height),0,32) pygame.display.set_caption('Animation') background=pygame.image.load('bg.png') UP='up' LEFT='left' RIGHT='right' DOWN='down' sprite=pygame.image.load('down.png') spritex=200 spritey=130 direction=DOWN pygame.mixer