sprite

Box2d Bodies that are really close together, are getting “stuck”

血红的双手。 提交于 2019-12-24 10:40:49
问题 Im using a tiled tmx map, and I created a class that adds bodies to each tile within a certain layer. This has been working great so far except for when a character or an enemy moves around on the screen, its body gets stuck on an edge between two tiles. This seems to happen "sometimes" and in certain spots. Jumping makes u unstuck but its annoying when it happens, and i tried increasing the position iterations, but the problem keeps reoccurring. Heres what my game looks like: http://i.stack

pygame: What is the difference between an image and a sprite?

旧街凉风 提交于 2019-12-24 09:26:15
问题 What is the difference between importing a rocket sprite (for example) and setting it as an image vs importing a rocket sprite and setting it as a sprite in pygame? 回答1: I think you're just getting confused about the terminology: Image An image is just a collection of pixels. You're using "sprite" to refer to an image on the disk, but that's just an image file. To use your rocket example, you would load the image like this: rocket_img = pygame.image.load('rocket.png').convert_alpha() You can

Issues with batch drawing with atlas files and SpriteKit

北城余情 提交于 2019-12-24 08:41:33
问题 So I ran into a problem with lag on a platformer game I'm building. So I'm researching how to improve performance. I'm trying to do batch drawing, so that there is less draw calls. I'm having issues though. So with a brand new project: I have 4 hero sprites, all images are stored in a .atlas folder. so there is a 1/2/3x image for each sprite in the atlas folder. I drag and drop that into the xcassets folder. Then I go to my sks file create 4 sprites and change the texture accordingly. By

Direct3d/C# - Blur area under a rectangle drawn on a sprite

女生的网名这么多〃 提交于 2019-12-24 08:09:43
问题 Any idea how to do it? I am drawing a rectangle that is supposed to be a half-transparent window. I managed to do the transparency by drawing a half-transparent texture, but I also want to blur whatever is under the window. Normally (eg. using GDI) I would create a bitmap of the area, blur it and paint it as the background of my window. With Direct3D I don't even know how to get the area with whatever is already rendered on it. Or even there can be a different approach, can't it. Please help.

Draw a sprite onto the map not to the screen

让人想犯罪 __ 提交于 2019-12-24 03:15:01
问题 I'm using libgdx and I have a tiled map which i want to draw the sprite onto. However the sprite is drawn onto the actual window so when I move the camera, the sprite stays in the same place. ?I want to the sprite to move on the map. This is how i currently render my objects @Override public void render(float delta) { translateCamera(); Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); camera.update(); renderer.setView(camera); renderer.render(bgLayers); batch.begin()

read sprite css always in fullscreen size?

一曲冷凌霜 提交于 2019-12-24 02:59:10
问题 I try to animate a sprite with auto fullscreen size but I don't know how can I do to read this sprite always in fullscreen (i.e. 100% of width and height of screen, and auto adapte if resizing) any idea to autosize sprite ? @-moz-keyframes play { 0% { background-position: 0%; } 100% { background-position: 100%; } } @-webkit-keyframes play { 0% { background-position: 0%; } 100% { background-position: 100%; } } @keyframes play { 0% { background-position: 0%; } 100% { background-position: 100%;

Creating a Group to add my Class to in Pygame

蓝咒 提交于 2019-12-24 02:22:11
问题 I am currently making a game in Pygame, and would like to generate several platforms randomly throughout my screen. However, I can't seem to figure out how to create a group so that I can draw several sprites at once. I have tried using super.__init__(self) and also replacing self with (*Group) , yet it isn't working. I also have just tried to add it to a group. How should I make my group and how do I correctly add my sprite to it? Here is the code (the sprite I want to add in is created here

<ul> Sprite Issue

≡放荡痞女 提交于 2019-12-24 00:59:54
问题 I have the following code <ul id ="menu"> <%foreach (var pckg in Model) { %> <li style = "text-align:center;width:60px;" class = "top-<%=pckg.Controller.ToLower() %>"> li-text </li> <%} %> </ul> and following is the sprite CSS .top-pkg1{ background-position: -184px 0; width: 36px; height: 36px; } .top-pkg2{ background-position: -270px 0; width: 36px; height: 36px; } .top-pkg3{ background-position: -356px 0; width: 36px; height: 36px; } .top-pkg4{ background-position: -517px 0; width: 36px;

AS3 Cannot access stage from custom class

社会主义新天地 提交于 2019-12-24 00:44:46
问题 How can I access the stage and especially the width and mouse position of the flash Movie from a custom class? package classes { import flash.events.*; import flash.display.*; public class TableManager extends Sprite { public function TableManager() { sayStage(); } public function sayStage():void { trace(stage); } } } This will only return nill. I know that DisplayObjects don't have any stage until they have been initiated so you can't access the stage in your constructor but even if I call

pyglet: changing the image of a sprite instance when pressing a button

天大地大妈咪最大 提交于 2019-12-23 20:48:09
问题 This code displays the image assassin1.png on a black background. As soon as I press the key the image moves to the right and stops moving as soon as I release the key. As soon as I press the key it should also change to the image assassin2.png and when I release the key it should change back to assassin1.png . This code however never displays the assassin2.png image while moving. Why is this so and how can I fix this? import pyglet class Assassin(pyglet.sprite.Sprite): def __init__(self,