5 Replies - 1770 Views - Last Post: 26 November 2012 - 03:57 AM Rate Topic: -----

#1 omrixable  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 23-November 12

2D jump (java,c# or c)

Posted 23 November 2012 - 11:01 AM

hello and thanks in advance to all helpers:).
my main language is java but since what i am trying to create is mainly graphical i will stick with c i guess.
i am a beginner programer so please dont write complicated things without explain first.
i want to create a game like super mario the classic (for pc), i am really only at the starting point when he walks on the ground right and left but i dont know how to make him jump, iasked few poeple and some said i need to use object priented proggraming and make Vy and Vx each a diffrent object but that sounds's to complicated for that and to be honest even if i do for each Vy and Vx object i will still dont know what to do than, so my main request is to know how to make a player jump up and down and also to the sizes ( like a balsitic movement ) , not somehting to complictaed and tricky.
i am working in turbo c and i hate every second of it so if anyone knows a better free programe please do tell.
Again thanks alot.

Is This A Good Question/Topic? 0
  • +

Replies To: 2D jump (java,c# or c)

#2 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 1
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: 2D jump (java,c# or c)

Posted 23 November 2012 - 06:16 PM

If you don't know what you're doing it can't be made simple for you, and no-one is going to guide you step-by-step.

For future development check out Visual C++ Express.
Was This Post Helpful? 0
  • +
  • -

#3 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10771
  • View blog
  • Posts: 40,105
  • Joined: 27-December 08

Re: 2D jump (java,c# or c)

Posted 23 November 2012 - 06:42 PM

I have a tutorial on 2D gravity. If you are working in Java, check out the Swing API for Graphics.
Was This Post Helpful? 0
  • +
  • -

#4 omrixable  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 23-November 12

Re: 2D jump (java,c# or c)

Posted 24 November 2012 - 12:18 AM

thanks, but visual studio doesnt support c, only c ++.
Was This Post Helpful? 0
  • +
  • -

#5 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 1
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: 2D jump (java,c# or c)

Posted 24 November 2012 - 08:23 AM

Who said that?!
Was This Post Helpful? 0
  • +
  • -

#6 JL29  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 50
  • Joined: 20-May 10

Re: 2D jump (java,c# or c)

Posted 26 November 2012 - 03:57 AM

Why use C instead of C++ for games?

And if you don't have a clue about what you are doing (vx and vy as an object??? :tt2:/> ) I'd suggest learning some thing or two about a language of choice first.

One of the most simple (and ugly) methods of jumping is creating a player class, wich contains a x and y position, a jumpspeed and a jumpheight variable. Then just adjust the y position when a key (up or space, or whatever you want) gets pressed. Ssomething among the lines of:

GAME:
if(space is pressed) {
    PLAYER.ystart = PLAYER.y;
    PLAYER.jumping = true;
}



PLAYER: (update)
if(jumping) {
    if(y > ystart - jumpheight) { //y minus equals up in this case
         y--;
    } else {
     jumping = false }
}



of course this can be done alot better and there need to be checks to see if the player has hit the ground before he can jump again, etc... etc... but I'll leave the rest as an exercise to you! ^^/>
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1