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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:37:02+00:00 2026-05-13T13:37:02+00:00

I have a sprite which will move right,left and jump. I need to add

  • 0

I have a sprite which will move right,left and jump.
I need to add the action to a animated sprite ie an animated sprite should jump, turn right and left.
Can anyone please tell me how to do it with sample code.

  • 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-13T13:37:02+00:00Added an answer on May 13, 2026 at 1:37 pm

    This is quite simple with cocos2d code here:

    Sprite *mySprite = [Sprite spriteWithFile@"mySprite.png"];
    [mySprite setPosition:ccp(x,y)];
    [self addChild:mySprite]; //This displays the Sprite in your layer
    

    Now for the sequence you intend to do…

    id moveRight = [MoveBy actionWithDuration:2 position ccp(x+k,y) //Where k is how much to the right you want it to go.
    id moveLeft = [MoveBy actionWithDuration:2 position ccp(x-k,y)];
    id jump = [JumpBy actionWithDuration:1 position:ccp (x,y) height:1 jumps:1];
    id sequence = [Sequence actions:moveRight,moveLeft,jump,nil];
    [mySprite runAction:sequence];
    

    Hope that’s clear.

    -Oscar

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

Sidebar

Related Questions

I have written a CSS sprite auto-generator which takes selected images out of the
I have a sprite loaded as a texture and I need to animate it,
I have a sprite which i animate using CCAnimate. the animation is composed of
So i have this sprite that is say arbitrarily 100 x 100 which is
i have a input tag which is non editable, but some times i need
I have a Flash sprite in my Director project. Under the Properties of that
I have a swf with loads text into a Sprite that resizes based on
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have a website which uses jQuery and lots of mouseover / mouseout effects.
Background: I have 8 images for every sprite in my bird's view JavaScript game,

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.