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

Username:   Password: 
 RegisterRegister   
 Click Click Defence
Index -> Programming, Turing -> Turing Submissions
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
copthesaint




PostPosted: Tue Jun 15, 2010 2:21 pm   Post subject: Click Click Defence

Well I was bored yesterday and today aswell, so I made this game, which my friends thought was pro :p its a very interactive defence game when you have to click click on every target before they reach the destination :p You need both files to play, and they both must be in the same director

if anyone gets to level 10 without cheat engine, printscreen and show me! lol



Click Defence.t
 Description:

Download
 Filename:  Click Defence.t
 Filesize:  3.04 KB
 Downloaded:  235 Time(s)


StarDebrisClass.tu
 Description:

Download
 Filename:  StarDebrisClass.tu
 Filesize:  5.66 KB
 Downloaded:  187 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Cezna




PostPosted: Tue Jun 15, 2010 2:46 pm   Post subject: RE:Click Click Defence

Lags a bit, but has a very cool explosion animation.

You should use View.UpdateArea instead of View.Update (I believe it was actually you who posted the topic where I learned that even if you are using View.UpdateArea to view the whole screen, it goes faster than View.Update, but sorry if I'm wrong)

EDIT: in this section of the code:
Turing:

particles -> newStar (x - 1 + i, y, o (i).clr)


What does the -> mean, I have seen it before, but have no idea what it does.
Is this how you avoided using a process for the death effect?
copthesaint




PostPosted: Tue Jun 15, 2010 2:49 pm   Post subject: RE:Click Click Defence

Lol It doesnt lagg, its just your computer... lol, The computer you used to test it, was it a win 98? or what? No offence, it's just old desktop with win me runs this without lagg.

Also, thanks, but this isnt me asking for help, also the -> is just a reference to the method from the pointer


Too prove no *lagg* replace the code of the loop main program with this where View.Set is and down with this:

The most delay Ill ever get in-game is 7 ms which you will only get if you reach lvl 7! *I dont believe possible lol
plus there is a Time.Delay since last of 24 ms, so there is no lagg

Turing:
View.Set ("Graphics,OffscreenOnly,NoButtonbar")
particles -> initStarsIDAll
levelTimer := Time.ElapsedCPU - 10000
lvl := 1
var currentTime, prevTime : int := 3
loop
    currentTime := Time.ElapsedCPU
    put "Total Delay: ", (currentTime - prevTime)
    prevTime := Time.ElapsedCPU
    Mouse.Where (mX, mY, mB)
    timer := Time.ElapsedCPU
    if mB = 0 and reset = true then
        reset := false
    end if

    if mB ~= 0 and reset = false then
        clicked := true
        reset := true
    end if

    if levelTimer + 15000 < timer then
        lvl := lvl + 1
        newObject (Rand.Int (1, 4))
        levelTimer := Time.ElapsedCPU
    end if

    for i : lower (o) .. upper (o)
        if (o (i).timeDelay + Time.ElapsedCPU) <= timer and o (i).running = false then
            resetObject (i)
        end if
        if o (i).running = true then
            if clicked = true then
                if ((mX - o (i).x) * (mX - o (i).x)) + ((mY - o (i).y) * (mY - o (i).y)) < 49 then
                    freeObject (i)
                    deathEffect (round (o (i).x), round (o (i).y), i)
                    score := score + round ((o (i).vel + (lvl / 20)) * 1000)
                end if
            end if
            moveObject (i)
            drawfilloval (round (o (i).x), round (o (i).y), 6, 6, o (i).clr)
        end if
    end for
    particles -> drawStars
    View.Update
    %Time.DelaySinceLast (24)
    cls
    %exit when lives <= 0
    drawfillbox (0, 0, maxx, maxy - 25, 24)
    Font.Draw ("Score: " + intstr (score), 5, maxy - 12, fnt1, black)
    Font.Draw ("Lives: " + intstr (lives), maxx - 72, maxy - 12, fnt1, black)
    if levelTimer + 12000 < timer then
        Font.Draw ("Level " + intstr (lvl) + " in: " + intstr (round ((levelTimer + 15000 - timer) / 1000)),
            maxx div 2 - (Font.Width ("Level " + intstr (lvl) + " in: " + intstr (round ((levelTimer + 15000 - timer) / 1000)), fnt2) div 2), maxy div 2, fnt2, black)
    end if
    clicked := false
end loop
Cezna




PostPosted: Tue Jun 15, 2010 3:22 pm   Post subject: Re: Click Click Defence

My pc is a duo core running Windows XP, with nothing running in the background but one firefox tab.

It might not be lag, but instead just the deathEffect running its course, I would have to understand that pointer thing a little better to know for sure (I am still learning classes by reading a tutorial on this site).

As for the View.Update, I was trying to point out some advice that you gave here:

http://compsci.ca/v3/viewtopic.php?t=20238

I did not mean for it to come across as condescending.

Below is a picture taken with print screen on level 2 or 3 I think it was, and it got up to 254 one time, but I couldn't hit printscreen fast enough to catch it, so this is it on the tail end of the lag spike.



delay.bmp
 Description:
 Filesize:  833.08 KB
 Viewed:  86 Time(s)

delay.bmp


copthesaint




PostPosted: Tue Jun 15, 2010 3:37 pm   Post subject: RE:Click Click Defence

just as I thought, your computer. Go, press Ctrl-Alt-Delete then go to resource monitor and check what's consuming your processor. Also saying duo core, doesnt help. I would need to know how much Ghz for each core and how much ram you have.

If you read the whole discussion here
http://compsci.ca/v3/viewtopic.php?t=20238
you find out that really there isnt any benefit unless you want trailing lines and using it for the whole screen aswell doesnt save any substantial speed.

Next time Pm me cause this is way off topic and false judgments...
copthesaint




PostPosted: Tue Jun 15, 2010 3:38 pm   Post subject: RE:Click Click Defence

I have to say, you probably just here on killed my topic from any responses to the program it's self...
Monduman11




PostPosted: Tue Jun 15, 2010 3:41 pm   Post subject: RE:Click Click Defence

nope he didint i played ur game and it think its awsome lol way better than mine Smile how long did it take to make? and how do you do the shattering effect?
copthesaint




PostPosted: Tue Jun 15, 2010 3:44 pm   Post subject: RE:Click Click Defence

It took me 4 hours to make it in total time, The shattering effect is just a bunch of variables in arrays that are recalled and a bunch of other stuff that is hard to explain in something short and sweet! basically arrays. look at the starDebrisClass
Sponsor
Sponsor
Sponsor
sponsor
Monduman11




PostPosted: Tue Jun 15, 2010 3:46 pm   Post subject: RE:Click Click Defence

kk i will thx Razz btw great game Razz
Cezna




PostPosted: Tue Jun 15, 2010 4:03 pm   Post subject: RE:Click Click Defence

As you can see, healthy debate does not ruin interest in a program (and if it did, doubling posting can't possibly help)
Very Happy

And about the View.UpdateArea, I am just regurgitating what you posted, so it must do some good (however small a boost in speed) or it wouldn't have been posted.

As for my speed, I know how to check my resources, and there is next to nothing running on this machine.
And just because it has a long delay, that dosn't mean that my machine is slower than any other average machine.... that could just as easily mean the program is lagging it up because it is doing so much.

Anyway, I did not mean to seem overly aggresive, and if I did, I apologize.

Despite anything I said, it is still a great game.
chrisbrown




PostPosted: Tue Jun 15, 2010 6:32 pm   Post subject: RE:Click Click Defence

Try these changes to smooth things out (may need to adjust):
Turing:

o (i).vel := Rand.Int (1000, 2000) / 3000  %Line 31
Time.DelaySinceLast (8)  %Line 98
copthesaint




PostPosted: Tue Jun 15, 2010 8:06 pm   Post subject: RE:Click Click Defence

uggh, I dont believe a word you say Cezna, Show me an Nfo of your computer then if its legit, I'll believe its my program.

@chrisbrown For his computer, unfortionatly that wont help since he is running at 93 ms per loop, 20X Aprox. slower then my own computer, and 3X slower then my Old standalone. However that will smoothen it out for other computers Smile but is 100+ cycles per loop really needed? lol, Wink I wish my tv ran that many cycles... Sad
chrisbrown




PostPosted: Tue Jun 15, 2010 8:15 pm   Post subject: Re: RE:Click Click Defence

copthesaint @ Tue Jun 15, 2010 8:06 pm wrote:
but is 100+ cycles per loop really needed?

Why limit it at all? I was actually going to suggest you make it time-based, and remove the delay altogether. This seemed like an easier way though, at least for faster machines.
copthesaint




PostPosted: Tue Jun 15, 2010 11:28 pm   Post subject: RE:Click Click Defence

I was going to use Fps, but I was set to a goal for first version to get done during two lunches XD. The computers at school will not be accessible anymore so I wanted to post it so I can download it :p When I get bored during this summer, I will work and actually try to make it a good quality game. this was just something I throw together quickly over 2 hours using an older class of mine lol.
Cezna




PostPosted: Wed Jun 16, 2010 5:40 am   Post subject: RE:Click Click Defence

As I explained, that 94 was a spike, not the consistent running speed (which was around 3 to 4 most of the time).
Don't know what an Nfo is Embarassed

Anyway, that dosn't really mater, and I think both of us have gone too far with it.

I do look forward to your next release though!
And just an aside, if you want to transfer anything else, Google Docs is always an option, as it also allows you to upload files (good ol' cloud computing), so you won't have to post them to the site.
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 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: