terry494 / cocos2d-android-1

Automatically exported from code.google.com/p/cocos2d-android-1
0 stars 0 forks source link

problem when adding sprites on layer #89

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

public class JoystickLayer extends CCLayer{
    private CCSprite button_a1, button_a2, joystick_bg, joystick;
    public static final float button_x = GameLayer.maxX - 20, button_y = GameLayer.minY - 20, 
    joystick_x = GameLayer.minX - 20, joystick_y = GameLayer.minY - 15;

    public JoystickLayer(){
        button_a1 = CCSprite.sprite("button_a1.png");
        button_a2 = CCSprite.sprite("button_a2.png");

        button_a1.setPosition(button_x, button_y);
        button_a2.setPosition(button_x, button_y);
        button_a2.setVisible(false);

        joystick_bg = CCSprite.sprite("joystick_bg.png");
        joystick = CCSprite.sprite("joystick.png");
        joystick.setPosition(joystick_x, joystick_y);
        joystick_bg.setPosition(joystick_x, joystick_y);

        this.addChild(button_a1);
        this.addChild(button_a2);
        this.addChild(joystick_bg);
        this.addChild(joystick);
    }
------------------------------------------------------
I added four png on the same layer to implement a simple joystick and one 
button. But the image cannot be loaded properly. I find that the problem comes 
with the four "this.addChild(...)"
if i add joystick first, the left part comes right but the right button won't 
show. if i add button first, the image comes as attatched

Original issue reported on code.google.com by qiankang...@gmail.com on 15 Jul 2011 at 5:10

Attachments:

GoogleCodeExporter commented 8 years ago
Add: I set FPS true but cannot see it at the left buttom

Original comment by qiankang...@gmail.com on 15 Jul 2011 at 5:17

GoogleCodeExporter commented 8 years ago
updated again:
problem solved after using code from github.......

Original comment by qiankang...@gmail.com on 15 Jul 2011 at 5:33