Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 9 of 9

Thread: Platform game sidescrolling

  1. #1
    Junior Member
    Join Date
    May 2013
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Platform game sidescrolling

    Hey I am new with java and was following a video tutorial to learn it, but something that works with the tutor doesn't work for me and I don't know what is wrong.
    It needs to do sidescrolling when A or D is pressed (A=left D=right) but it doesn't! In fact, my character won't even more anymore.

    And I don't know how to show you the codes because i can't add URLs

    Thanks in advance!


  2. #2
    Member tyeeeee1's Avatar
    Join Date
    Sep 2012
    Posts
    61
    Thanks
    31
    Thanked 2 Times in 2 Posts

    Default Re: Platform game sidescrolling

    Just CnP the code here. All you need to do would be something like this:

    -Every time your game loop does a loop, check if A or B is pressed; if the A key is pressed then do X-- else if the B key is pressed then do X++.
    -Now just render the screen with the new X location at the center.

    I can't really say much more than that without your code.

  3. The Following User Says Thank You to tyeeeee1 For This Useful Post:

    teunissenstefan (May 13th, 2013)

  4. #3

  5. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Platform game sidescrolling

    Copy and paste the code here, preferably as an SSCCE

  6. #5
    Junior Member
    Join Date
    May 2013
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Platform game sidescrolling

    Wait what? SSCCE?
    There are multiple files so which one should i post?
    Last edited by teunissenstefan; May 13th, 2013 at 03:33 PM. Reason: I dont want to spam xD

  7. #6
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Platform game sidescrolling

    Quote Originally Posted by teunissenstefan View Post
    Wait what? SSCCE?
    There are multiple files so which one should i post?
    See the link in my signature

  8. #7
    Junior Member
    Join Date
    May 2013
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Platform game sidescrolling

    Uh, but how is it possible to Copy and paste as SSCCE?

  9. #8
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Platform game sidescrolling

    Quote Originally Posted by teunissenstefan View Post
    Uh, but how is it possible to Copy and paste as SSCCE?
    1) Create an SSCCE 2) Copy the code 3) paste the code into the text box when posting to the forums - wrap all code using the [highlight=java][/highlight] tags

  10. The Following User Says Thank You to copeg For This Useful Post:

    teunissenstefan (May 14th, 2013)

  11. #9
    Junior Member
    Join Date
    May 2013
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Platform game sidescrolling

    create a SSCCE? how da hell should i do that?
    I thought it was a method to do something :S

    --- Update ---

    Oh nevermind, the code was actually right i always forget to save some xD
    Thanks all that wanted to help

Similar Threads

  1. Controlling a platform game character with the mouse.
    By subsidian in forum What's Wrong With My Code?
    Replies: 4
    Last Post: March 18th, 2013, 07:45 PM
  2. [SOLVED] collision between player and platform
    By hwoarang69 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 30th, 2012, 10:50 PM
  3. Cross-Platform game
    By ggcon2 in forum Java Theory & Questions
    Replies: 1
    Last Post: June 27th, 2012, 02:33 PM
  4. Why java is platform independent(Video)
    By jessie143143 in forum The Cafe
    Replies: 5
    Last Post: April 28th, 2012, 01:59 AM
  5. [SOLVED] Platform game player doesn't respond to keyboard
    By jesamjasam in forum What's Wrong With My Code?
    Replies: 4
    Last Post: December 12th, 2010, 09:44 AM

Tags for this Thread