EdnaC's Recent Projects http://scratch.mit.edu/feeds/getRecentUserProjects/37006 Recent Projects Feed for EdnaC en-us Sat, 5 Jul 2008 22:12:33 GMT CakePHP Han and Andres genghisu SubHunt http://scratch.mit.edu/projects/EdnaC/136815 The Japanese navy is in retreat and you have been left behind to disrupt the enemy onslaught. You captain a top of the line attack submarine, when on the surface, it can outrun all but the fastest of the enemy ships. Your mission: stop as many of the enemy ships as possible with the torpedoes at your supply base. The enemy is steaming South, how many of their ships can you sink? Arrow Keys control Throttle and Rudder "P" toggles Sonar Pinging "D" toggles Dive/Surface "Spacebar" to Launch a Torpedo If you are on the surface or are "pinging" when close to an enemy ship, you will be spotted and a Destroyer will be called in to hunt you down - use active sonar and surface running carefully! Your sub can carry 4 torpedoes, you must return to your base (within the boundary of the dashed line) to rearm the sub. Ships that make their way south of your home island are considered to have "escaped"... Credits: Thanks to the "Freesound Project" for the various sounds of the sub, torpedo and the scout airplane. Also, many thanks to "The Guardian" for the elegant "digit" code used to display the score/torpedo count/ships escaped, and to the Scratchers whose comments and ideas helped to make SubHunt a better game as work progressed on it. Tech Notes: Because of the limited screen size of Scratch, the game needed to be a scroller. "Scrolling" is accomplished by moving the islands (and ships) over the blue "stage". Each sprite maintains its own "World_X" and "World_Y" variable in response to its velocity, and its display position is maintained by finding the difference between its world coordinates and the Submarine's. The submarine is normally displayed in the center of its own "Sonar Screen", but when a torpedo is launched, it moves from "home", in the direction opposite the torpedo, to give the effect of having the "camera" follow the torpedo. This lets you shoot at a target that is running away and about to go off-screen, yet still see the results of your shot. The world positions of the islands and ships are scaled to allow them to be represented by similarly scaled sprites in the Sonar Screen. These positions are used to avoid collisions with islands and to monitor the distance from the ships to the scout plane. If close enough to the scout plane, the sonar image of a ship will go from a ghost effect of 99%, down to zero (fully visible), then gradually fade as its position becomes uncertain. http://scratch.mit.edu/static/projects/EdnaC/136815_sm.png ShuttlePilot http://scratch.mit.edu/projects/EdnaC/129777 Scratch is a starship being constructed from an iron-rich asteroid that will be hollowed out and transformed into a ship. It will intercept, and attach to, an outbound comet. while the bulk of the comet protects the ship, the water, hydrogen and minerals of the comet will be used to support the colony of humans, complete construction of the ship, and provide the fuel to power and propel SCRATCH on its voyage. As a shuttle pilot, you have the chance of a lifetime: Tryout for a position as a shuttle pilot to support the SCRATCH mission... http://scratch.mit.edu/static/projects/EdnaC/129777_sm.png RedBaron http://scratch.mit.edu/projects/EdnaC/116094 Preliminary Upload to test online performance. RedBaron will eventually get more terrain and a "mission". Arrow keys to turn, Down Arrow to "Pull Back" on the stick, Up Arrow to "Push" the stick. Hold "Back" to loop, if you ease off on the stick, the Baron will level off. If you do this near the top of the loop, he'll perform an "Immelman". "Down" stick will send the Baron into a dive, he'll level off on his own. "Down" and "Left" (Up Arrow AND Left Arrow) will initiate a roll and half-loop (the opposite of an Immelman). Flight is restricted to three "flight levels" 15 Mar 08: Work begins on "enemy". 16 Mar 08: Space to "shoot" 18 Mar 08: Enemy now shoots back http://scratch.mit.edu/static/projects/EdnaC/116094_sm.png GravArena http://scratch.mit.edu/projects/EdnaC/110327 Your ship has been trapped in a corner of space claimed by an advanced alien race. The aliens have mastered gravity, and use it as a source of power, and can even use it as a weapon. Luckily, you command a ship designed by NASA, the "National Aeronautics and Scratch Administration", that carries weapons which will enable you to battle your captors. Use up arrow to fire your thruster, left and right arrow to turn your ship. Spacebar fires plasma cannons (your primary weapon, as it is unaffected by the alien gravity field). Down arrow will launch a "dumb" proximity bomb that will fall toward the enemy gravity source and explode if it comes into contact with their ships or weapons. http://scratch.mit.edu/static/projects/EdnaC/110327_sm.png AwfulKanwful http://scratch.mit.edu/projects/EdnaC/106094 Discussions in the forums about detecting slope, combined with a recent show about Evel Knievel that I saw on the History Channel, prompted me to work on an Evel tribute. The bike uses the color of its wheels to detect terrain and act accordingly. The scripts started out pretty complicated and ran rather slowly, but after some whittling down, it now works pretty well. Lots of comments are included to help explain how the simulation works. In essence, the bike move the direction that it's pointed unless it isn't touching the ground. In this case to moves by the Vx and Vy that it was previously, and decreases Vy by the amount of "Gravity". It would be possible to count how many times the bike was touching the ground to determine how hard it hit and cause a "crash". This would be pretty fun on a scrolling background, or in a project where you could draw your own "ramps". http://scratch.mit.edu/static/projects/EdnaC/106094_sm.png BouncingBall http://scratch.mit.edu/projects/EdnaC/102490 Response to a question in the forums about bouncing off of "random" surfaces. After a miserable failure at slope detection, I gained some inspiration from Jens: http://scratch.mit.edu/projects/Jens/98418 Also, many thanks to Canthiar for his tutorial on "reflection" using Vector algebra: http://scratch.mit.edu/projects/Canthiar/41976 If you are ever wondering "why do I need to learn this" when presented with Vectors, the answer is: You don't, unless you are interested in math, science, engineering, optics, cosmology, etc..., or programming video games. Vectors are a very powerful tool, and once you understand them, they prove to be a simple way to solve a daunting problem. This version adds "spin": This part of the project is a fudge, I've added some damping, and used "fudge factors" to estimate how much the spin/impact should effect velocity. Playing around with the fudge factors got the ball to the point where it looks pretty realistic, but this isn't accurate physics. Remove anything to that references "Tangent" or "Spin" and you can get back to the real world (with drag neglected). Damping could be removed as well, if spin is taken out. Otherwise, you'll see the "Flubber Effect"... http://scratch.mit.edu/static/projects/EdnaC/102490_sm.png ProjectilePhysics http://scratch.mit.edu/projects/EdnaC/101420 Projectile motion challenge! Press "S" to Start Real Physics, using the textbook equations for motion. Try to aim (up/down arrows) to hit the target. When you press "Spacebar", your projectile will be fired, and at that same instant, the cord holding the Bowling Ball up will be cut. and it will start to fall. If you know your Physics, you'll do well, despite the "strange" units of measure used in the Scratch world: Gravity is Gravity after all, no matter how you choose to measure it! http://scratch.mit.edu/static/projects/EdnaC/101420_sm.png SlidingScrollingCar http://scratch.mit.edu/projects/EdnaC/86855 An update to "DriftCar", this project adds a scrolling background - DriftCar always needed more real estate, and I was curious about scrolling in X and Y. Arrow Keys to Steer, Up Arrow to Accelerate, Down arrow for brakes. The "world" for the car is comprised of 4 sprites: UpperLeft, UpperRight, etc., with the "rotation center" of each in the corner that will be the center of the "world". This lets Scratch push the background almost off the screen so that the whole world is available. The "Map" Sprites are a bit crude... Sorry. The variable displayed in the upper left is reset (along with the timer), when you press "t". It counts updates (increments each time the program does a "move") for 10 seconds, then divides the number by 10 and stops, giving an idea of the "frame rate". If you download and are "looking at" a sprite that does a lot of calculating (like the car), it gives a value that is about 1/2 of what presentation mode gives. I'm curious what it will show in "Java". http://scratch.mit.edu/static/projects/EdnaC/86855_sm.png DriftCarV3 http://scratch.mit.edu/projects/EdnaC/85136 Updated to use the new "Sensing" block and avoid Global Variables. Steering now "centers" if left alone. Arrows to steer, Up arrow to Accel, Dwn Arrow to brake or back up. A scrolling background is next for "Drift Car", just to experiment with scrolling... http://scratch.mit.edu/static/projects/EdnaC/85136_sm.png 3d_TacticalNukes http://scratch.mit.edu/projects/EdnaC/81934 A two person, turn-based projectile shooter. You control a turret that launches shells at your opponent - And, during your turn (25 seconds), you can change position. Use the upper (Tactical) view to drive the turret and plan your shots. The lower view shows the elevation of the structures between you and your enemy. Supplies will drop during the game: Ammo (Nuke marker) takes time to load into your turret, so beware, you may be left exposed. Upgrades will allow you as many shots per turn as you can fire. The ferocious winds effect your shells, look at the direction and strength before firing. When your time is up, your turret will dig in to try to survive... http://scratch.mit.edu/static/projects/EdnaC/81934_sm.png HealthBarsDemo http://scratch.mit.edu/projects/EdnaC/81880 A demo of one way to display something like "Health". The Health bars are "Stamped" based on two Global Variables that you can control in the demo using sliders. To use in a project, you would "broadcast" the message that pressing "spacebar" does in this demo. The bars rely on stamping the background color over the existing stamps when it's time to "remove health". This demo leaves the text in place, but could be modified to "stamp" over that as well if desired. http://scratch.mit.edu/static/projects/EdnaC/81880_sm.png Projectile http://scratch.mit.edu/projects/EdnaC/75922 How to fire and track the position of a projectile using a "Guide" Sprite to keep track of the velocity and direction of the projectile. Wind could easily by incorporated by adding a move to the guide sprite's script (change x by "wind effect"). http://scratch.mit.edu/static/projects/EdnaC/75922_sm.png GravityGuyWithBounceAndJump http://scratch.mit.edu/projects/EdnaC/72080 This is a follow-up to the GravityGuy with Bounce demo. The logic error that let GravityGuy sink thru the floor has been corrected, and now he can jump. There is some extra "unconnected" code included in the project. If you download the project and connect the extra code, GravityGuy will gain a new ability. Remember that there are lots of ways to accomplish things in Scratch, there is nothing magical about the way I did things or the variable names. This program is built a bit differently from the previous ones, using more "Broadcasts". As with the other projects, lots of comments are included that should make it clear how the program works. Feel free to download and use as desired, either to study or to remix. http://scratch.mit.edu/static/projects/EdnaC/72080_sm.png GravityGuyWithDampenedBounce http://scratch.mit.edu/projects/EdnaC/71684 Follow up to "GravityGuyWithBounce". Now GravityGuy's bounce is "dampened". Instead of using -1 to switch his Velocity_Y variable, this program uses a negative number with a magnitude of less than one. It also shows a logic error (a Bug) in the program; because gravity is applied any time that he isn't touching Black, and the "AlreadyBouncing" variable gets reset only if he isn't touching Red, it's possible for him to "sink" thru the red "floor" if the rebound value (bouncy-ness) is too small. Try adjusting the value to see this effect. Next update to GravityGuy will be a re-write to fix this problem and give the user input to control Gravity Guy's motion. He'll also gain the ability to "jump" ! http://scratch.mit.edu/static/projects/EdnaC/71684_sm.png GravityGuyWithBounce http://scratch.mit.edu/projects/EdnaC/70950 This is a follow-up to the GravityGuy demo. A common question, after Scratchers figure out how to make a Sprite respond to gravity (fall), is "how do I make my sprite bounce ?". http://scratch.mit.edu/static/projects/EdnaC/70950_sm.png