Platform game in 4 days
Uploader Comments (Viliam1234)
All Comments (24)
-
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
-
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.
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 8 months ago
@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 8 months ago
@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 8 months ago
@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.
Viliam1234 8 months ago
how you made collisions?
Neomex000 2 years ago
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); }
Viliam1234 2 years ago