Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Terrorist Attack
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Metal Mayhem




PostPosted: Fri Jul 07, 2006 7:49 pm   Post subject: Terrorist Attack

Made This In about 15 Minutes Played it for a hour and 15 minutes have fun


terrorist.t
 Description:
This is it

Download
 Filename:  terrorist.t
 Filesize:  1.6 KB
 Downloaded:  357 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Jul 07, 2006 8:16 pm   Post subject: (No subject)

Coding wise it could use some improvements
code:

for X : 1 .. maxx
                for Y : 1 .. maxy
                    if View.WhatDotColour (X, Y) = green then

is by far not the best approach.

Though I've got to admit, this is a very creative use of Draw.Fill Very Happy

One improvement I want to suggest is a detonator key, to speed up the game play.

+Bits
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
NikG




PostPosted: Fri Jul 07, 2006 10:39 pm   Post subject: (No subject)

Tony wrote:
Though I've got to admit, this is a very creative use of Draw.Fill Very Happy
I definitely agree.

Good job. Only suggestion I have (other than Tony's detonator suggestion) is to contol where the bombs are created because right now they can overlap.

Tip to all who play: draw squares around the bomb, not circles.
Delos




PostPosted: Fri Jul 07, 2006 10:58 pm   Post subject: (No subject)

I like it! This is a good start - keep at it and you will improve tremendously. Hit up the [Turing Walkthrough] to check out some of the tuts available. You're off to a good start.

+bits
Tony




PostPosted: Sat Jul 08, 2006 12:11 am   Post subject: (No subject)

NikG wrote:
Tip to all who play: draw squares around the bomb, not circles.

Better tip is to draw continues shapes around clusters of bombs, you don't need a polygon around each bomb.

A better tip is that since (1,1) location is the only thing you're trying to protect...



terrorist_game_ss.JPG
 Description:
 Filesize:  7.4 KB
 Viewed:  2368 Time(s)

terrorist_game_ss.JPG


Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
NikG




PostPosted: Sat Jul 08, 2006 1:47 am   Post subject: (No subject)

Tony wrote:
A better tip is that since (1,1) location is the only thing you're trying to protect...

Whoa, that's quite a trick!

I guess you'd need a check for every pixel on the screen to fight that...
Clayton




PostPosted: Sat Jul 08, 2006 4:00 pm   Post subject: (No subject)

Ha Tony! I tried that before i even read the rest of the posts.

Now as for the coding, why not have a record for all of your boxes for each round? then you can have a flexible array of all of your boxes. This way you can drastically cut down on your searching for green pixels by using the x and y coordinates of a box, Draw.Fill'ing from it, check to see if (1,1) is red, if it isnt, check another box, etc etc, until either (1,1) is red, or (1,1) isnt red.

EDIT: You could also randomize the point at which you check for an uncovered bomb, this would be to stop people like Tony and myself from cheating Twisted Evil , just make sure that a bomb doesnt cover that point Wink Also, note that this should have been submitted in [Turing Source Code], [Turing Applications] is where your zipped .exes etc go Very Happy

EDIT 2: Here is your game modified with records and a randomized checking point (note its an exe so you cant copy Very Happy), try and recreate what I have done. Notice that chances are you cant try what Tony did anymore, and that the check and Draw.Fill goes much faster now. If you have any questions post and someone will help you out.
Tony




PostPosted: Sun Jul 09, 2006 12:34 am   Post subject: (No subject)

SuperFreak82 wrote:
You could also randomize the point at which you check for an uncovered bomb, this would be to stop people like Tony and myself from cheating Twisted Evil , just make sure that a bomb doesnt cover that point Wink

Do you mind sharing that part of the code? Wink

Randomization kind of sucks since under same conditions you sometimes win and sometimes loose.

I suppose a better way would be to "protect the targets", so let the user know precisely where the checks will be done. And have enough to ensure that it's still easier to circle the bombs (original intent) rather then protecting just few targets. I think that if flow gets to the edge of the screen, that should be count as a lost
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
iker




PostPosted: Wed Jul 12, 2006 5:11 pm   Post subject: (No subject)

Its a simple game thats fun. Now i have a suggestion for scoring. You should have a counter for the amount of pixils that are shown after the explosion. If the circles are too big, then theres more red pixils, or a bigger explosion. If the counter gets too high for any level, then the person should lose. So right where the program draws the red dots, you could add the counter, and reset it for each level.
Clayton




PostPosted: Wed Jul 12, 2006 7:51 pm   Post subject: (No subject)

Tony wrote:

Do you mind sharing that part of the code?


hm, well ill try, I'm in Belleville right now (about three hours away from where I live) and I wont be getting home untill July 29, so I dont exactly have the code with me right now...

However, all is not lost, I will do my best and try and remember how it went...

NOTE: I dont have access to Turing, so if this code doesn't run, dont harp about it plz Very Happy

Turing:

var box : flexible array 1..0 of
    record
        x,y : int
    end record
var check_x, check_y : int
var right : boolean := false
var bombs : int := 1
const radius : int := 40
const size : int := 15
loop
     loop
        new box, bombs
            loop
                exit when right
                right := false
                check_x := Rand.Int (1, maxx)
                check_y := Rand.Int (1, maxy)
                for j : 1..bombs
                    box(j).x := Rand.Int(1,maxx-size)
                    box(j).y := Rand.Int(1,maxy-size)
                    exit when Math.Distance(box(j).x + size div 2, box(j).y + size div 2, check_x, check_y) <= radius
                    right := true
                end for
            end loop
    %do the rest of the game here...
    end loop
end loop


That is basically it i believe, pop that into his code and see if it works, if you find an error try and fix it, or post back here and tell me about it.

If you dont know what is going on here... go back to a classroom (j/k). Okay, basically, i randomize the checking point, check to see if it is within a specified radius, if it is, start the loop over again, etc etc, until the check point is far away enough from the bombs, then go onto the game.

I realize that this could be a very long process at later stages of the game, however this makes the game much harder and could make game last less time, but theres the code, make what you will of it Very Happy

EDIT: 3 edits later i think i have the code logically organized...
EDIT2 : not quite, i have 4 edits here...
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: