sprite

Android OpenGL 2.0 Sprite Optimization

拟墨画扇 提交于 2020-01-03 04:50:27
问题 Hej, I'm creating simple game for Android in OpenGL ES 2.0. The game will contain few types of different sprites, but these will occur more than once. For now let's say I have 1 object (sprite). So far I've implemented VBO and Index buffering, so an object as whole is stored on GPU, as I understand. What I would like to do now is to draw this object multiple times, only thing differing it's position. As for now, this is implemented as follows: glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer

How to move node in the direction of another node

泪湿孤枕 提交于 2020-01-03 03:29:08
问题 I found the this answer on Stack overflow, but I want to make a modification to it that I just can't figure out. The answer to that question shows how to make the missile move in the direction of your finger. However, I want it to move in the direction of another node (in my case a ship) Meaning that instead of following my finger, it follows the ship. How can a achieve this? Thanks very much 回答1: It is very simple: 1) Instead of touchesMoved use update method. 2) Instead of touch location

How to break an image into 9 small ones (sort of puzzle pieces)

假如想象 提交于 2020-01-03 03:04:36
问题 So, I tried creating a little puzzle game, which at the moment looks something like this The top is the puzzle where you can put pieces that are chosen from a table with 1 row (scrollable) from the bottom of the page Problem is those are 9 individual images cut from the original one. I want to have only one image (the big one) and have them put into the bottom table in a similar manner to what's in the picture above in this post. For simplicity sake, assume every table cell is 206px width

Java a moving animation (sprite)

拈花ヽ惹草 提交于 2020-01-02 08:48:50
问题 Hello i`ve got a problem: when i run this code i get this: on some java forum they said i need to add Graphics2DObject.clearRect(x1, y1, x2, y2); (where`s x1 and y1 is coordinates of the image and x2 y2 is width height of the image.) when i add it to the code i get this: The code(with added function): Main: import java.awt.*; import javax.swing.*; public class Main { public static void main(String []args){ Main b = new Main(); b.run(); } private Sprite sprite; private Animation a; private

How to make sprites in Android

北城以北 提交于 2020-01-01 19:41:24
问题 I'm developing a game which includes sprites. currently I'm loading a bitmap and using Rectangle to get the right frame from the bitmap. the problem is loading bitmaps takes too much memory and I wont be able to load several sprites at the same time. what are my alternatives for doing sprite in Android? 回答1: Try this one: import org.cocos2d.layers.CCLayer; public class GameLayer extends CCLayer{ CCSprite mSprite; protected GameLayer() { super(); CGSize winSize = CCDirector.sharedDirector()

LibGDX guidance - sprite tracing 2D infinite random bezier curve

耗尽温柔 提交于 2020-01-01 17:09:25
问题 I've been able to apply a smooth animation to my sprite and control it using the accelerometer. My sprite is fixed to move left and right along the x-aixs. From here, I need to figure out how to create a vertical infinite wavy line for the sprite to attempt to trace. the aim of my game is for the user to control the sprite's left/right movement with the accelerometer in an attempt to trace the never ending wavy line as best they can, whilst the sprite and camera both move in a vertical

How can I test sprite collision in cocos2d?

瘦欲@ 提交于 2020-01-01 12:25:08
问题 How do I start to implement a class for sprite collision? 回答1: As Eric pointed out, CGRectIntersectsRect is the method to test two bounding rects for overlapping. Use the boundingBox method of the CCNode classes to get the correct bounding box for each sprite (or other node). See my answer here: Collision Detection in Cocos2d game? 回答2: I would look into b2ContactListener You can do some searches on that, and you'll easily get some results 回答3: You can also perform very simple collision

android open gl really slower than canvas?

China☆狼群 提交于 2020-01-01 06:52:05
问题 im testing the android SpriteMethodTest and on default settings canvas is getting 58fps while open gl is between 50-55fps, and the gap just gets larger with more sprites. I was under the impression that opengl is faster than canvas so is this wrong? or is their something wrong with my phone (htc desire)? http://code.google.com/p/apps-for-android/source/browse/trunk/SpriteMethodTest/ 回答1: It should be noted that SpriteMethodTest is not using OpenGL at maximum efficiency. Each sprite is being

White vertical lines and jittery horizontal lines in tile map movement

筅森魡賤 提交于 2020-01-01 03:57:16
问题 I'm having trouble finding an answer as to why the tile sheets I am making for our tile maps create vertical white lines and jittery horizontal lines while moving around on screen, using libGDX. Here is a video showing the white vertical lines: https://www.youtube.com/watch?v=34V64WacMo4 Here is one showing the horizontal jittery lines: https://www.youtube.com/watch?v=LiozBZzxmy0 For comparison, here is a project I worked on earlier this year without GDX. You can see the tilemap moves

Cocos2d and SpriteBatchNode: cannot identify which sprite frame is causing an Assertion to fail

久未见 提交于 2019-12-31 03:56:04
问题 I have already asked something similar but I can't figure out properly how to debug this. That's the question. I added some Exceptions handler (catches all Objective-C) exceptions and that's the result of what I see: The problem is with the setTexture method and it fails at the assertion verifying whether the texture name that needs to be displayed is the same as the one in the current sprite batch node. This happens when trying to replace one scene with another but doesn't happen all the