Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7968881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:08:52+00:00 2026-06-04T07:08:52+00:00

I have a game in progress where the player can only move left and

  • 0

I have a game in progress where the player can only move left and right, but at certain places on the map they can push up or down to go to a new scene in those directions (such as through a door in a back wall).

How can I set up my SneakyJoystick to trigger some code when the user pushes down? At the moment it’s doing the below to move my player left/right, I want this to continue, but (for now) for a CCLOG to execute when the player pushes the stick entirely up, or down. Any ideas?

- (void) applyJoystick:(SneakyJoystick *)aJoystick forTimeDelta:(float)deltaTime {
    CGPoint scaledVelocity = ccpMult(aJoystick.velocity, 325.0f);
    CGPoint oldPosition = [self position];
    CGPoint newPosition = ccp(oldPosition.x + scaledVelocity.x * deltaTime, oldPosition.y);

    [self setPosition:newPosition];
    if (oldPosition.x > newPosition.x) {
        self.flipX = YES;
    } else if (oldPosition.x == newPosition.x) {
        // Intentionally do nothing to preserve orientation at start of scene!
    } else {
        self.flipX = NO;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:08:53+00:00Added an answer on June 4, 2026 at 7:08 am
    int extra = 20;
    if ((int) aJoystick.degrees > 270 - extra && aJoystick.degrees < 270 + extra) {
        // Joystick button seems to be pointing down
    }
    

    I think that works. I don’t remember well. I think 270 degrees is perfectly down. I am checking if the direction degree is within a certain range (270 – 20 and 270 + 20).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple game that is in progress. As of right now all
I have this game where balloons are coming from bottom and player has to
We have a game that is very close to being released, but we have
I have a progress bar as a healthbar in a game. The healthbar regenerates
I'm designing a text-based adventure game for a school progress. I have each level
I have a problem. There is class to store game progress: struct GameData {
I have user, game and player models, and in my game's show page I
I am in progress of making my first 3D game, but I stuck into
I have a card game (screenshot below) in which I display player avatars. For
I'm writing a game for Android. When the user completes a level, they can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.