Platform game in 4 days

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
9,759
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Aug 20, 2008

I wrote this platform game for a four-day programming challenge. It was made in Java standard edition using Eclipse programming environment. The pictures were made in Inkscape vector editor. It has no sounds.

See: http://viliambur.blogspot.com/2008/08/platform-game-in-four-days.html


Túto plošinovú hru som napísal v rámci štvordňového programátorského súboja. Je napísaná v jazyku Java (standard edition) pomocou vývojového prostredia Eclipse. Na grafiku som použil vektorový editor Inkscape. Hra nemá žiadne zvuky.

Viď: http://viliam-bur.blogspot.com/2008/08/plosinovka-za-styri-dni.html

Category:

Gaming

Tags:

License:

Standard YouTube License

  • likes, 3 dislikes

Link to this comment:

Share to:

Uploader Comments (Viliam1234)

  • one question how do i make it so the player collides correctly with blocks? on many attempts at a platformer he would be able to fall through certain places, jump up or get stuck in the middle of a block. please help!

  • @forrest0no

    1) Approximate player by rectangle, check if rectangles intersect.

    2) Divide player movement into many 1-pixel moves. Process them while they are possible (while there is no collision with any wall after move). If next move is not possible, set player speed to zero.

    3) Semipermeable platforms: detect collision with them only if initially player's feet are above their surface.

    The description contains a link to article, which contains a link to source code.

  • @Viliam1234 the link takes at least an hour to load and gives me error messages. but would i use a for loop using the speed, then cap it off at the first collision? or would that be too high on cpu (considering the large number of tiles possibly used) ?

  • @forrest0no Computers are incredibly fast these days, don't underestimate them! A for-loop will run in a microsecond. Code first, optimize later -- usually the optimization won't be necessary.

    In my game, there are only a few tiles, so I check them all. If you have thousands, perhaps try to divide the area into segments (some tiles will be in multiple segments). Then only check tiles in segments that intersect with player rectangle. Remove 90-99% tiles by a rough guess, then check the remaining.

  • how you made collisions?

  • Very simply -- rectangle with rectangle. ;-) Both the hero and snails have approximately rectangular shapes. Also walls and platforms. The formula for collision between rectangles is:

    if ((a.left < b.right) && (b.left < a.right) && (a.top < b.bottom) && (b.top < a.bottom) { collision(a, b); }

see all

All Comments (24)

Sign In or Sign Up now to post a comment!
  • You can chack my TowerDefence Java game, i`ve made it in 6 days(2 for map editor 4days for game, it is still in progress) you tube . c o m \ watch?v=9EM4P4Nztfs&feature=ch­annel_video_title

  • @Viliam1234 thanks, and also the multi comment, youtube was being really stupid and saying i couldnt post. so it lied. again. Well thank you alot for the help!

  • @Viliam1234 I cant get the link to work... Oh but since i want the player to move considerably fast, could i use a for loop, goal being the speed, and check each situation and cap it off once it finds an impossible situation?

  • @treeclimbingkid yes he used something else to make it, yet with your 3rd question, just add a new frame or make a new movie clip to contain the next floor, and program accordingly.

  • Just finished updating my java game and a zip with a jar and all the resources is online!! It's on my channel.... check it out

    (youtube..dot..com) /watch?v=-3I_hUg06Dg

  • @treeclimbingkid

    See the DESCRIPTION. It was made in Java (no actionscript). The video is recording of me playing the game. I play the blue man; the snails and platforms move automatically.

    In the linked article there is a link to download source code. Each level is constructed from individual pieces (walls, floor, snails, apples, platforms). Their starting positions are described in source code (in a perfect world, they would be in configuration file), then they move according to rules.

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more