IPT - A Virtual Approach IPT A Virtual Approach by Peter Whitehouse
Quick Links:
 
 
Information and Intelligent Systems Social and Ethical Implications Human Computer Interaction Software and Systems Engineering eXercise Files Course Outline and Assessment A-Z of Geeky Acronyms Terrace Work Program 2004 Sillybus FAQ = Frequently Asked Questions Help
 
 

eXercise #24

Some more simple Visual Projects

  1. Targeting Systems

    In this project, you are working a simple keypad of sorts, in later projects we will learn how to link this movement to the keyboard and even track the mouse. Construct a screen as follows (in a NEW FOLDER):
    On Target
    sight.bmp | target.bmp
    unTargeting.pas, ontarget.dpr, frmRiflerange, imgTarget (200px x 200px), imgSight (100px x 100px), btnUp (50px x 50px),...etc, timShoot.

    This is a component of a more complex game, but useful in it's own right.

    Your mission, Jim, is to on formcreate, randomly position the target and the sight, then, while running, use the U D R L buttons to steer the sight to the target before pressing the FIRE button to register your shot. You gain a point if the sight is on the target.

    Extra for experts: using the distance formula (this is collision detection 2.01b):
    distance formula
    calculate how close the centre of the sight is from the centre of the target and point score accordingly - you invent a scheme of points - closer to bullseye pays more. (x = .left ish; y = .top ish)

    Extra Extra for experts: using the timer, allow the target to remain in one position for a limited amount of time.



  2. Spawning Systems

    Skeet-Shoot - a "Bang the Weasel" variant.


    Skeet shooting is where people with rifles target "clay pigeons" that have been catapaulted into the air when the person with the gun yells "pull" ... truly rooly.

    Make a new folder, called skeetshoot
    then delphi project save as unGame.pas; skeetshoot.dpr


    Name the form frmRifleRange; timer called timMove; labels called targets, hits, misses.

    Add a main menu, add 2 toplevel entries: "new" and "pull"

    skeetshoot form design

    When running, a click on the pull option should dynamically spawn five (5) TShapes (width 20, height 10, colour random) somewhere in the left third of the form, and they should move right until they exit the form and are destroyed when they leave the form.

    At spawn, the number of active targets should be displayed, as they leave, this total should decrease.

    When a user clicks on a skeet, the hit counter should go up, the skeet should go away. When they click but miss a skeet, the miss counter should go up.

    The running skeetshooter
    run me | look at the code

    Clicking on "New" should reset the game ready for a new game.

    Extra for experts: currently the "misses" just records how many unsuccessful shots - have the program report how many targets got away as well.

    Extra extra for experts: when you spawn the skeets, tag them with a random number that can then be used to determine HOW FAST they travel (you should not need more timers to do this, just some decision logic in the move code)



  3. Animation: The Wonkybot - an excercise in Imagelist Management

    wonkybot design

    You must 'harvest' the graphics (windows .bmp files) needed for this project, to do this, follow each of the following links, saving them AS IS into your working directory...

    a.bmp | b.bmp | c.bmp | d.bmp | e.bmp
    f.bmp | g.bmp | h.bmp | i.bmp | j.bmp

    Image boxes: imgDude (115x130), img Blank; Timers (interval 100): walkcycle, mover; Imagelist (115x130): bucket; Buttons: btnRandom, btnStart, btnFaster, btnSlower, btnDone

    wonkybot running
    runme | check the code

    The walkcycletimer cycles through the images in the bucket imagelist, the movertimer moved the image container on te form, the result is the wonkybot looks like it is staggering across the form.

    Extra for Experts: have the bot push the window off the screen when he reaches the right edge; have him push an object off the form; speed him up, slow him down, make him moonwalk backwards.

wonko@wonko.info
©Copyright t 1992..2017+. Edition 25.150117
wonkosite
Creative Commons License
This work is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 2.1 Australia License
.