flappy-bird-clone

stop impulse on SKSpriteKit click

元气小坏坏 提交于 2019-12-02 04:05:18
i'm trying to create an pause button in my game. at the moment when you click on the screen it will apply an impulse on the mover spriteNode. The problem is that it still applying the impulse when i click the pause button. How can i create an pause button without creating the impulse also. i've tried changing the if statements to an else if and then making the last impulse part the else part, but this wont work. touchBegan method: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGPoint location = [touch locationInNode:self]; SKNode *node

Smooth fly movement like flappy bird or jet pack joy ride with gravity and Accelaration

纵然是瞬间 提交于 2019-12-01 21:07:46
I am developing a simple game in which a character fly when you tap/click the screen. keep tapping the character will fly (some what similar to flappy bird and jet pack). However the movement is not smooth at all, as of jet pack. Here is sample of my code. Varaible Initilization maxSpeedLimit = spriteHeight/10; speed = maxSpeedLimit/2; //half of the max speed touch event public void onTapOrClick(int action) { if (action == UP) { sprite.up= true; } else { sprite.up = false; } } Sprite update called from game loop public void update() { if (up) { y -= speed; //fly up } else { y += speed;// fly

How can I scroll more than one object at the same time?

梦想与她 提交于 2019-11-26 10:48:27
New question was asked after this one, found here . I'm new to Java, but I am working on a recreation of "Flappy Bird" to learn more about java and the way that graphics are displayed. Any solutions or suggestions to any of my questions is greatly appreciated. Thanks! Right now, my program makes a random pipe and scrolls it, but I don't need it to keep scrolling when x1-3 = -83 ( this is when the pipe will be off of the screen completely and is no longer needed ). Questions How can I make my Game.class scroll more than one instance of Pipes.class while adding a preset distance between them? I