This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

Cash_Cash
Cash_Cash presents ...

2009/5/10

Mars Patrol

~~<CONTROLS>~~
Left/Right - Move
Up - Jump
Space - Shoot

~~<OBJECTIVES>~~
- Get SCORE by destroying barrels
- Get SCORE by destroying helicopters
- SURVIVE by jumping over ditches
- SURVIVE by dodging bombs

~~<CREDITS>~~
Programmer: Xiang Yi Cheow
Artwork and Graphics: Xiang Yi Cheow

~~<SPECIAL THANKS>~~
Programming Help: Mr. Hayes, Adrian Wan, Moodle Community, Greenfoot Tutorials
Artwork and Graphics Help: Ernest Lim
Music: SoundsJay.Com Shockwave-Sound.Com

~~<DEDICATED TO>~~
Mr. Hayes & CT Class

8936 views / 22 in the last 7 days

6 votes | 0 in the last 7 days

Tags: space game rocket awesome fun with-source arcade addicting platform inspiring barrel cool tank martian red planet helicopter xiang yi entertaining sensational legendary

This scenario is a member of: CIS-May-2009


open in greenfoot
Your browser does not support the canvas tag.
ChinncChinnc

2009/5/23

@cashcash i was holding down spacebar so the rockets should have been spamming (which they were, no errors there) but the moonjumping gave me a hard time with more than three holes in a row, but its fine, we see things differently and i will not ask you to change your game, do as you see fit @fatfat im not blaming the programmer, merely pointing things out that could possibly improve, whether he heeds my advice/comments is up to him
Errr. hate to disagree mates but. uhm...so far no ones has found a problem with the scenario except you Chinnc. so..maybe it was a one time glitch? your computer? maybe the scenar just doesn't like you :S I've played this game and i have yet to encounter that problem..just saying.
mjrb4mjrb4

2009/5/23

Well, I think I get the problem chinc's describing, sometimes it is difficult to jump when there's lots of holes that have been formed in a row. But every time I've died so far, while that problem was due to too many holes, I'm pretty sure with better positioning on my part I could've overcome the problem and made it across. There MIGHT be situations where it is actually impossible, but I would've thought that could be classed more as a feature than a bug, and it'd probably require a lot of code reworking to fix if it was there at all (note: probably not worth it.) I'll grab the source and have a look at it when I get round to it to see if I can see anything that's wrong and perhaps demonstrate how to include "normal" jumping - I'll post back when I've poked around a bit. While I'm at it, to point out a couple of comments I noticed: "maybe it was a one time glitch? your computer? maybe the scenar just doesn't like you :S" Logical deduction perhaps, but it's very unlikely that it'll work slightly differently on one computer to another due to how Java works - generally the scenario will either work or it won't. You can generally rule that out unless it's a big undisputable thing that's clearly different (like a non-working applet with a huge error message for example!) "I assure you, there are no glitches with the jump or jump distance okay? promise i've tested it so many times. (:" However many times you test something, this never really guarantees that it's completely fault free! One of my friends coded a web mashup the other day, and was absolutely sure it always worked and validated. I loaded it 2 times and there was a big tag floating in the middle of the page, and yup, the HTML that the php script stuck out was indeed invalid. Just one example, and I'm not saying there ARE glitches in your code at all - just be aware that that's quite a bold statement to make!
Cash_CashCash_Cash

2009/5/24

the way i tested it was not by running the scenario over and over again. I actually placed four holes with gaps that the tank is unable to land on and tested the jumping distance, because the max number of holes that will appear in-a-row is 4. Otherwise, the world will stop spawning holes and the helicopter will not drop more bombs :/
Cash_CashCash_Cash

2009/5/24

wait my mistakes, it wont stop dropping bombs. but it can only drop 2 bombs in a row, which will then create a gap the tank should be able to land on.
GreenThumbGreenThumb

2009/5/24

Graphics are alright. Gameplay+Concept, are amazing. Downloaded the source code, pretty interesting approach
Cash_CashCash_Cash

2009/5/24

thank you everyone for trying my game out and commenting on it, truly appreciate that. please "like" it if it's up to your standards! :D
mjrb4mjrb4

2009/5/24

Well I've just got a chance to download and look at the source :-) Firstly - very well done on this front! It's good to see things commented nicely all the way through, proper indendation, and all fields set to private, and as a result I could easily navigate my way through your source. These things do make a big difference! Now onto the method of jumping, these are the changes I made to include "smooth" jumping rather than just up and down: - Firstly, make jumpFall a double and initialise it to 0. This will be the amount that we're travelling by vertically. - Next, I changed your checkJump method to: | public void checkJump() | { | if ( Greenfoot.isKeyDown("up") && onGround() ) | { | Greenfoot.playSound ("jump.wav"); | setLocation(getX(), getY()-1); | jumpFall = -5; | } | } This just sets jumpFall to (you can change this depending on how far you want to jump, or put it as a field.) - Finally, I modified your descend method thus: | if ( !onGround() ) | { | Ground g = (Ground)getWorld().getObjects(Ground.class).get(0); | int maxFall = g.getY()-getY()-g.getImage().getHeight()/2-getImage().getHeight()/2; | System.out.println(maxFall); | if(maxFall<jumpFall) { | jumpFall = maxFall; | } | setLocation ( getX(), (int)(getY() + jumpFall)); | } | jumpFall+=0.1; This is probably some of what you tried before - it increments jumpFall by a value (0.1), and if we're not on the ground it moves the tank in the Y axis with the value of jumpFall. However, to stop the Tank sinking into the ground it has an extra bit. We first get the distance between the bottom of the tank and the top of the ground: int maxFall = g.getY()-getY()-g.getImage().getHeight()/2-getImage().getHeight()/2; As you can see, this just involves getting the y position of the ground, then taking away the tank's y position, then taking away half the height of the image's of each of the ground and tank. After we've got this, we can then test to see if jumpFall is greater than maxFall, and if it is we can just set it to maxFall, preventing the tank from sinking into the ground :-) Michael
mjrb4mjrb4

2009/5/24

Ignore the System.out.println statement in the above code by the way, you can get rid of that - I had it in for debugging purposes to find out what silly mistake I'd made ;)
Cash_CashCash_Cash

2009/5/24

haha yes the real problem is that if there's gravity, the tank sinks into the ground. but since you fixed this problem, O_O omg i'm so glad!! (: thank you so much. will release a better version soon. cheers mate :D

See all comments

Want to leave a comment? You must first log in.

Who likes this?

Antonio thegreencoolerman mjrb4 SurrealDesires Freezersting polle