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 7499761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:56:23+00:00 2026-05-29T19:56:23+00:00

In a game that I am making whilst using Cocos2d, I have a sprite

  • 0

In a game that I am making whilst using Cocos2d, I have a sprite down the bottom of the screen that stays still. When the screen is tapped, I would like the sprite to move to where the screen was tapped, and then animate through the series of frames, then move to its original position. I know that I will need to use a CCSequence, but I don’t yet know how to make it move to the location of the touch. At the moment, I have searched around and I am using this code:

-(void) TouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *Touch = [touches anyObject];
CGPoint location = [Touch locationInView:[Touch view]];
[swat runAction:[CCMoveTo actionWithDuration:3 position:location]];}

I am getting no errors, but the sprite is unresponsive. Any ideas?

  • 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-05-29T19:56:24+00:00Added an answer on May 29, 2026 at 7:56 pm

    First, you have a typo in method’s name. It’s “ccTouchesBegan”, not “TouchesBegan”.

    -(void)ccTouchesBegan:(NSSet*)touches withEvent:(UIEvent*)event

    Second, your sprite will not move to where you expect. locationInView returns point in UIKit coordinates, and CCMoveTo uses OpenGL coordinates. You need to convert the point to OpenGL coordinates:

    UITouch *touch = [touches anyObject];
    CGPoint location = [touch locationInView:[touch view]];
    location = [[CCDirector sharedDirector] convertToGL:location];

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

Sidebar

Related Questions

I am making a game that needs a crosshair. I have been playing with
I am making a 2D game in javascript/ajax, that will be using data stored
I have a somewhat simple game that I'm making and now that I'm testing
I'm using UDP for a game that I am making, but this issue is
I'm making a game that involves buttons moving across the screen. When one button
I am making a grid-based game that will be much larger than the screen,
I have a game that I am making and I want to add a
I am making a game that needs to be updated. I have two JAR
I am making an iPhone game that will be using Game Center to support
Trying to implement a timer for my game that I'm making. I have a

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.