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

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




PostPosted: Thu Jul 26, 2012 12:54 am   Post subject: PonyQuest

Hello everyone, this my first post to the CompSci forums. I'm a Grade 10 student and after joining the computer science club at my school decided to get into computing. So over summer I've decided to create a game that is a cross-over of Braveheart, a popular game on iOS and Android, and a tv series that has gotten a lot of attention over the past year here on the internet. My Little Pony: Friendship is Magic.

Now the game is coming along fine, making progress everyday, and I'd just like to create this topic to
show my progress on the game, and give myself a little bit of motivation to finish it very soon. If you obviously more experienced guys
have any suggestions for systems I should implement, or any suggestions about art assets in the game feel free to leave reply.

Right now I only want to show screenshots of in-game footage (videos later) as I'm trying to keep this in an alpha environment, but when I feel the
game is playable,cleaned up and I have given credit to all the assets I provide and updates executables.

What I really wanted to do is make a game where everything is outside the code, so it would be possible to simply replace assets and change the game completely.
So far most things are easily replaceable outside the code, doing this is very time consuming, but worth it if I want to change something later.

Pony animations from The Open Source Desktop Ponies, other images from the show, or deviantart (will give credit soon)

Posted Image, might have been reduced in size. Click Image to view fullscreen.
Mouse Over the options button
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Mouse Over the Quest button
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Mouse over nothing
Posted Image, might have been reduced in size. Click Image to view fullscreen.
The pony selection screen, first menu implemented and needs some work (after I get the combat systems in)

Done:
-All assets resized to fit window by default
-Settings.ini file to load and save settings
-Anypony can be added
-Sound SYstem
-Basic Stats
-4 Ponies
-Runs in any 16:9 Resolution, anything else goes into settings.ini file
-Default resolution is 720p, screenshots were downsized

In progress:
-Combat systems
-Save systems
-Battle scenes
-Better Battle system
-Interactive Menus

Needs to be optimized/improved:
-Framerate for battle scenes (I used processes for the ponies, whoops)
-Pony Select Screen GUI

Planned to be implemented:
-Shop/Inventory
-Everypony has equipables
-Enemies
-Unique attacks that can be imported (How can I do this?)
-Difficulty (hard)

Suggestions:
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Thu Jul 26, 2012 2:58 am   Post subject: RE:PonyQuest

Friendship is Magic. Looking good, though there's no code to comment on.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
OmniDex




PostPosted: Thu Jul 26, 2012 7:39 am   Post subject: Re: PonyQuest

code:
process animatepony (tpony : int, toponyname : string,
        ponynumin : int)
    var pic, pics, picsflip : flexible array 1 .. 0 of int
    var pic2, pics2, pics2flip : flexible array 1 .. 0 of int
    var pic3, pics3, pics3flip : flexible array 1 .. 0 of int
    var numFrames : array 1 .. 100 of int
    var delayTime : int
    var tponyname : string := toponyname

    numFrames (1) := Pic.Frames ("Characters/" + tponyname + "/" + tponyname + "_Walk.gif")
    new pics, numFrames (1)
    new pic, numFrames (1)
    new picsflip, numFrames (1)
    Pic.FileNewFrames ("Characters/" + tponyname + "/" + tponyname + "_Walk.gif", pic, delayTime)

    numFrames (2) := Pic.Frames ("Characters/" + tponyname + "/" + tponyname + "_Stance.gif")
    new pics2, numFrames (2)
    new pic2, numFrames (2)
    new pics2flip, numFrames (2)
    Pic.FileNewFrames ("Characters/" + tponyname + "/" + tponyname + "_Stance.gif", pic2, delayTime)

    numFrames (3) := Pic.Frames ("Characters/" + tponyname + "/" + tponyname + "_Attack1.gif")
    new pics3, numFrames (3)
    new pic3, numFrames (3)
    new pics3flip, numFrames (3)
    Pic.FileNewFrames ("Characters/" + tponyname + "/" + tponyname + "_Attack1.gif", pic3, delayTime)

    for i : 1 .. numFrames (1)
        pics (i) := Pic.Scale (pic (i), floor (wm * Pic.Width (pic (i))), floor (hm * Pic.Height (pic (i))))
        Pic.SetTransparentColor (pics (i), 12)
        picsflip (i) := Pic.Mirror (pics (i))
        Pic.SetTransparentColor (picsflip (i), 12)
        Pic.Free (pic (i))
    end for
    for i : 1 .. numFrames (2)
        pics2 (i) := Pic.Scale (pic2 (i), ceil (wm * Pic.Width (pic2 (i))), ceil (hm * Pic.Height (pic2 (i))))
        Pic.SetTransparentColor (pics2 (i), 12)
        pics2flip (i) := Pic.Mirror (pics2 (i))
        Pic.SetTransparentColor (pics2flip (i), 12)
        Pic.Free (pic2 (i))
        %     Pic.SetTransparentColor (pics2 (i), 12)
    end for
    for i : 1 .. numFrames (3)
        pics3 (i) := Pic.Scale (pic3 (i), ceil (wm * Pic.Width (pic3 (i))), ceil (hm * Pic.Height (pic3 (i))))
        Pic.SetTransparentColor (pics3 (i), 12)
        pics3flip (i) := Pic.Mirror (pics3 (i))
        Pic.SetTransparentColor (pics3flip (i), 12)
        Pic.Free (pic3 (i))
        %     Pic.SetTransparentColor (pics2 (i), 12)
    end for
    var spritest : int
    ponysprite (ponynumin) := Sprite.New (pics (1))
    Sprite.SetHeight (ponysprite (ponynumin), ponyposy (ponynumin))
    Sprite.SetPosition (ponysprite (ponynumin), 0, 100, false)
    Sprite.Show (ponysprite (ponynumin))
    %loop
    %for i : 1 .. numFrames (1)
    %Sprite.Animate (ponysprite (ponynumin), pics (i), 100 * ponynumin, 100 * ponynumin, false)
    %Sprite.Animate (ponysprite (ponynumin), picsflip (i), 100*ponynumin*2, 100*ponynumin*2, false)
    %delay (40)
    %end for
    %end loop

    loop
        %exit when stopanim (ponynumin) = true
        if ponyattacking (ponynumin) = true then
            fork PlaySFX ("Characters/" + tponyname + "/" + tponyname + "_Attack.wav")
            for i : 1 .. numFrames (3)
                exit when stopanim (ponynumin) = true
                %Draw.FillBox (0, 0, maxx, maxy, 15)
                if ponydir (ponynumin) = "left" then
                    %    Pic.Draw (pics3 (i), ponyposx (ponynumin) - Pic.Width (pics3 (i)) div 2, ponyposy (ponynumin), picMerge)
                    Sprite.Animate (ponysprite (ponynumin), pics3 (i), ponyposx (ponynumin) - Pic.Width (pics3 (i)) div 2, ponyposy (ponynumin), false)
                    exit when stopanim (ponynumin) = true
                elsif ponydir (ponynumin) = "right" then
                    %    Pic.Draw (pics3flip (i), ponyposx (ponynumin) - Pic.Width (pics3flip (i)) div 2, ponyposy (ponynumin), picMerge)
                    Sprite.Animate (ponysprite (ponynumin), pics3flip (i), ponyposx (ponynumin) - Pic.Width (pics3flip (i)) div 2, ponyposy (ponynumin), false)
                    exit when stopanim (ponynumin) = true
                end if
                Sprite.SetHeight (ponysprite (ponynumin), maxy - ponyposy (ponynumin))
                delay (40)
                %exit when ponydir (ponynumin) = "right"
                %screenshot1 := Pic.New (50, 50, 150, 150)
                %waitrefresh
                %delay (1)
                %screenshot1 := Pic.New (50, 50, 150, 150)
                exit when stopanim (ponynumin) = true

            end for
            ponyattacking (ponynumin) := false
        elsif ponydir (ponynumin) = "left" and ponyattacking (ponynumin) = false then
            if ponygoing (ponynumin) = true then
                for i : 1 .. numFrames (1)
                    %Draw.FillBox (0, 0, maxx, maxy, 15)
                    %Pic.Draw (pics (i), ponyposx (ponynumin) - Pic.Width (pics (i)) div 2, ponyposy (ponynumin), picMerge)
                    Sprite.Animate (ponysprite (ponynumin), pics (i), ponyposx (ponynumin) - Pic.Width (pics (i)) div 2, ponyposy (ponynumin), false)
                    exit when ponydir (ponynumin) = "right"
                    Sprite.SetHeight (ponysprite (ponynumin), maxy - ponyposy (ponynumin))
                    delay (40)
                    %screenshot1 := Pic.New (50, 50, 150, 150)
                    %waitrefresh
                    %delay (1)
                    %screenshot1 := Pic.New (50, 50, 150, 150)
                    exit when stopanim (ponynumin) = true
                end for
            else
                for b : 1 .. Rand.Int (30, 100)         %idle animation timer
                    Sprite.Animate (ponysprite (ponynumin), pics2 (1), ponyposx (ponynumin) - Pic.Width (pics2 (1)) div 2, ponyposy (ponynumin), false)
                    exit when ponygoing (ponynumin) = true
                    delay (40)
                    %exit when stopanim (ponynumin) = true
                end for
                for i : 1 .. numFrames (2)
                    %Draw.FillBox (0, 0, maxx, maxy, 15)
                    %Pic.Draw (pics2 (i), ponyposx (ponynumin) - Pic.Width (pics2 (i)) div 2, ponyposy (ponynumin), picMerge)
                    Sprite.Animate (ponysprite (ponynumin), pics2 (i), ponyposx (ponynumin) - Pic.Width (pics2 (i)) div 2, ponyposy (ponynumin), false)
                    exit when ponygoing (ponynumin) = true
                    Sprite.SetHeight (ponysprite (ponynumin), maxy - ponyposy (ponynumin))
                    delay (80)
                    %screenshot1 := Pic.New (50, 50, 150, 150)
                    %waitrefresh
                    %delay (1)
                    %screenshot1 := Pic.New (50, 50, 150, 150)
                    exit when stopanim (ponynumin) = true
                end for
            end if
        elsif ponydir (ponynumin) = "right" and ponyattacking (ponynumin) = false then
            if ponygoing (ponynumin) = true then
                for i : 1 .. numFrames (1)
                    %Draw.FillBox (0, 0, maxx, maxy, 15)
                    %Pic.Draw (picsflip (i), ponyposx (ponynumin) - Pic.Width (picsflip (i)) div 2, ponyposy (ponynumin), picMerge)
                    Sprite.Animate (ponysprite (ponynumin), picsflip (i), ponyposx (ponynumin) - Pic.Width (picsflip (i)) div 2, ponyposy (ponynumin), false)
                    exit when ponydir (ponynumin) = "left"
                    Sprite.SetHeight (ponysprite (ponynumin), maxy - ponyposy (ponynumin))
                    delay (40)
                    %screenshot1 := Pic.New (50, 50, 150, 150)
                    %waitrefresh
                    %delay (1)
                    %screenshot1 := Pic.New (50, 50, 150, 150)
                    exit when stopanim (ponynumin) = true

                end for
            else
                for b : 1 .. Rand.Int (30, 100)         %idle animation timer
                    Sprite.Animate (ponysprite (ponynumin), pics2flip (1), ponyposx (ponynumin) - Pic.Width (pics2flip (1)) div 2, ponyposy (ponynumin), false)
                    exit when ponygoing (ponynumin) = true
                    delay (40)
                    %exit when stopanim (ponynumin) = true
                end for
                for i : 1 .. numFrames (2)
                    %Draw.FillBox (0, 0, maxx, maxy, 15)
                    %Pic.Draw (pics2flip (i), ponyposx (ponynumin) - Pic.Width (pics2flip (i)) div 2, ponyposy (ponynumin), picMerge)
                    Sprite.Animate (ponysprite (ponynumin), pics2flip (i), ponyposx (ponynumin) - Pic.Width (pics2flip (i)) div 2, ponyposy (ponynumin), false)
                    exit when ponygoing (ponynumin) = true
                    Sprite.SetHeight (ponysprite (ponynumin), maxy - ponyposy (ponynumin))
                    delay (80)
                    %screenshot1 := Pic.New (50, 50, 150, 150)
                    %waitrefresh
                    %delay (1)
                    %screenshot1 := Pic.New (50, 50, 150, 150)
                    exit when stopanim (ponynumin) = true
                end for
                exit when stopanim (ponynumin) = true
            end if
            exit when stopanim (ponynumin) = true
        end if
        exit when stopanim (ponynumin) = true
        %put ponydir (ponynumin)
        exit when stopanim (ponynumin) = true
    end loop
    Sprite.Hide (ponysprite (ponynumin))


    for i : 1 .. numFrames (1)         % Release Pictures from memory because there are so many
        Pic.Free (pics (i))
        Pic.Free (picsflip (i))
        %put "freeing"
    end for
    for i : 1 .. numFrames (2)         % Release Pictures from memory because there are so many
        Pic.Free (pics2 (i))
        Pic.Free (pics2flip (i))
        %put "freeing"
    end for
    for i : 1 .. numFrames (3)         % Release Pictures from memory because there are so many
        Pic.Free (pics3 (i))
        Pic.Free (pics3flip (i))
        %put "freeing"
    end for
end animatepony

Here is the current process for character movement, it's being changed into a more reliable procedure.
I'm also thinking of ways to make it shorter (It might just be all the comments though)
mirhagk




PostPosted: Thu Jul 26, 2012 9:57 am   Post subject: RE:PonyQuest

Your changing that into a procedure? Good. Processes are a terrible idea unless you have to (and if you have to, you either don't understand what you're programming, or you shouldn't be using Turing).
QuantumPhysics




PostPosted: Tue Jul 31, 2012 12:19 am   Post subject: RE:PonyQuest

For someone just getting into the CS area; your really good.
mirhagk




PostPosted: Tue Jul 31, 2012 12:40 pm   Post subject: RE:PonyQuest

This is actually really good for a grade 10, make sure you stay in compsci.

PS: @QuantumPhsyics shouldn't it be "if no one's perfect, why practise?" no one can't be plural, so the apostrophe after the s doesn't make sense.
OmniDex




PostPosted: Wed Aug 01, 2012 11:43 pm   Post subject: Re: PonyQuest

Thank you, the game is coming along very well. I've managed to get rid of processes, and only use forks for music and ability cooldowns. I would like to know if it was possible to import turing scripts on a case by case basis. Because I want abilities to be extremely customisable, Id like to know if I could load a script from each character's folder as a procedure, without the script being "present" at the time of compilation. The only command that I've been able to use so far is 'include' but I can't use something like include "/Characters"+charnames(i)+"/test.t" because it asks for the code at the beginning of compilation. Do I really have to make it stiff by reading text files and storing data?
edit: Also the current arena system: Looking into ways of spawning enemies in small groups
As of right now the Arena does not free any pictures or sprites
code:
proc Arena (stage :string,stagenum:int)
    var stageBG :int
    stageBG := Pic.FileNew ("Stage/" +stage+".bmp")
    include "Stage/Stage.t"
    var wave,checkdeaths : int := 0
    var innumFrames: array 1 .. upper (SpawnList(stagenum))of array 1..100 of int
    var inpics : array 1 .. upper (SpawnList(stagenum)) of array 1 .. 100 of array 1..100 of int
    var enemysprite : array 1 .. upper (SpawnList(stagenum)) of array 1 .. 4 of int
    var enemy,enemydir,enemybase,etarget,enemyx,enemyy,frame,frame2,maxframe2,maxframe: array 1 .. 10 of int
    var enemyalive : array 1..10 of boolean
    var shoot : array 1 .. 3 of boolean
    for i : 1 ..3
        SelStats (i) (battlehp) := SelStats (i) (hp)
    end for
       
    for i : 1 .. upper (SpawnList(stagenum))
        innumFrames (i) (1) := Pic.Frames ("Enemy/"+SpawnList(stagenum)(i)+"/walk.gif")
        Pic.FileNewFrames ("Enemy/"+SpawnList(stagenum)(i)+"/walk.gif",inpics (i) (10),delayTime)
        for j: 1.. innumFrames (i) (1)
            inpics (i) (1) (j) := Pic.Scale (inpics (i) (10) (j), floor(wm*Pic.Width(inpics (i) (10) (j))),floor(hm*Pic.Height(inpics (i) (10) (j))))
            inpics (i) (2) (j) := Pic.Mirror (inpics(i) (1) (j))
            Pic.Free (inpics (i) (10) (j))
            Pic.Draw (inpics (i) (1) (j),0,0,picCopy)
            Pic.SetTransparentColor (inpics(i) (1) (j),12)
            Pic.SetTransparentColor (inpics(i) (2) (j),12)
            pictotal += 2
        end for
           
       
        innumFrames (i) (2) := Pic.Frames ("Enemy/"+SpawnList(stagenum)(i)+"/attack.gif")
        Pic.FileNewFrames ("Enemy/"+SpawnList(stagenum)(i)+"/attack.gif",inpics (i) (10),delayTime)
        for j: 1.. innumFrames (i) (2)
            inpics (i) (3)(j) := Pic.Scale (inpics (i) (10)(j), floor(wm*Pic.Width(inpics (i) (10)(j))),floor(hm*Pic.Height(inpics (i) (10)(j))))
            inpics (i) (4) (j) := Pic.Mirror (inpics(i) (3)(j))
            Pic.Free (inpics (i) (10)(j))
            pictotal + = 2
            Pic.SetTransparentColor (inpics(i) (3) (j),12)
            Pic.SetTransparentColor (inpics(i) (4) (j),12)
        end for
    end for
       
   
    /*loop
    Pic.Draw (stageBG,0,0,picCopy)
    for i : 1..3
    Draw.FillBox (ponyposx(i)-Pic.Width (pics (i)(1))div 2,ponyposy(i) + Pic.Height (pics (i)(1)), floor (SelStats(i)(battlehp) /10) + ponyposx(i) ,ponyposy(i) + Pic.Height (pics (i)(1))+10,red)
    Draw.Box (ponyposx(i)-Pic.Width (pics (i)(1)) div 2,ponyposy(i) + Pic.Height (pics (i)(1)), floor (SelStats(i)(hp) /10) + ponyposx(i) ,ponyposy(i) + Pic.Height (pics (i)(1))+10,white)
    Sprite.Show (ponysprite (i))
    animatepony2 (1,selected(i),i)
    SelStats(i)(battlehp) -= 1
   
    end for
        View.Update
    delay (40)
    end loop*/
   
    loop %how waves go
        wave += 1
        for i : 1 .. 10 %Spawn Enemies
            var randomone : int := Rand.Int (1, upper (SpawnList (stagenum)))
            enemy (i) := Sprite.New (inpics (randomone) (1) (1))
            maxframe (i) := innumFrames (randomone) (1)
            maxframe2 (i) := innumFrames (randomone) (2)
            frame (i) := 1
            frame2 (i) := 1
            enemybase (i) := randomone
            for l : 1 ..100
                if enemynames (l) = SpawnList (stagenum) (randomone) then
                    eSelStats (i) := eStats (l)
                    exit
                end if
            end for
                eSelStats (i) (battlehp) := floor (eSelStats (i) (hp)*wave*1.1)
            eSelStats (i) (cooldownatk) := 100
            randomone := Rand.Int (1,3)
            etarget (i) := randomone
            if Rand.Int (0,1) = 1 then
                enemyx (i) := -Rand.Int (i,10) *  100
            else
                enemyx (i) :=  maxx+Rand.Int (i,10) *  100
            end if
            enemyy (i) := maxy - Rand.Int (i,12) *  100
            Sprite.Show (enemy (i))
            enemyalive (i) := true
        end for
            for i : 1 ..3
            hastarget (i) := false
            targetx (i) :=  ponyposx (i)
            targety (i) :=  ponyposy (i)
            shoot (i) := false
        end for
           
        loop
            Pic.Draw (stageBG,0,0,picCopy)
            for i :1..10
                if enemyalive (i) = true then
                    if eSelStats (i) (battlehp) < 0 then
                        enemyalive (i) := false
                        Sprite.Hide (enemy (i))
                    end if
                    if enemyx(i) > ponyposx(etarget(i)) +54 and enemyx(i) > ponyposx(etarget(i))  -54 then
                        enemyx(i) -=1
                        enemydir (i) :=1
                    elsif enemyx(i) < ponyposx (etarget(i)) +54 and enemyx(i) < ponyposx (etarget(i))  -54 then
                        enemyx(i) +=1
                        enemydir (i) := 2
                    elsif eSelStats (i) (cooldownatk) = 100 and ponyposy (etarget(i))  = enemyy  (i) then
                        eSelStats (i) (cooldownatk) := 0
                        fork ecooldown ((i),true)
                        SelStats (etarget(i)) (battlehp) -= eSelStats (i) (attack)
                        target (etarget (i)) := i
                    end if
                    if enemyy(i) > ponyposy (etarget(i)) then
                        enemyy(i) -=1
                    elsif enemyy(i) < ponyposy (etarget(i)) then
                        enemyy(i) +=1
                    end if
                    if frame (i) > maxframe (i) then
                        frame (i) := 1
                    end if
                    Sprite.SetHeight (enemy(i),enemy(i) -enemyy (i))
                    Sprite.Animate (enemy(i), inpics (enemybase(i)) (enemydir(i)) (frame(i)),enemyx (i) - Pic.Width ( inpics (enemybase(i)) (1) (frame(i))) div 2,enemyy (i), false)
                    frame (i) += 1
                    Draw.FillBox (enemyx(i)-Pic.Width (inpics (enemybase (i)) (1)(1)) div 2 -3,-3 + enemyy(i) + Pic.Height (inpics (enemybase (i))(1)(1)), floor (eSelStats(i)(hp) /10) + enemyx(i) +3 ,enemyy(i) + Pic.Height (inpics (enemybase (i))(1)(1))+18,black)
                    Draw.FillBox (enemyx(i)-Pic.Width (inpics (enemybase (i))(1)(1))div 2,enemyy(i) + Pic.Height (inpics (enemybase (i)) (1)(1)), floor (eSelStats(i)(battlehp) /10) + enemyx(i) - Pic.Width (inpics (enemybase (i)) (1)(1)) div 2 ,enemyy(i) + Pic.Height (inpics (enemybase (i))(1)(1))+15,statrgb(3))
                    Draw.FillBox (enemyx(i)-Pic.Width (inpics (enemybase (i))(1)(1))div 2,enemyy(i) + Pic.Height (inpics (enemybase (i)) (1)(1))+13, floor (eSelStats(i)(battlehp) /10) + enemyx(i) ,enemyy(i) + Pic.Height (inpics (enemybase (i))(1)(1))+15,white)
                end if
               
            end for
                for i : 1..3
               
                if hastarget (i) =true and SelStats (i) (aclass) = 0 then
                    if ponyposx(i) +54 > enemyx (target(i)) and
                            ponyposx(i) -54 > enemyx (target(i)) and hastarget (i) = true then
                        ponyposx (i) -=1
                        ponydir (i) := "left"
                        ponygoing (i) := true
                    elsif ponyposx (i)  +54 < enemyx (target (i)) and ponyposx (i)  -54 < enemyx (target (i)) and hastarget (i) = true then
                        ponyposx (i) +=1
                        ponydir (i) := "right"
                        ponygoing (i) := true
                    elsif SelStats (i) (cooldownatk) = 100 and ponyposy (i)  = enemyy (target (i)) and hastarget (i) = true then
                        SelStats (i) (cooldownatk) := 0
                        fork cooldown ((i),true)
                        ponyattacking (i) := true
                        eSelStats (target(i)) (battlehp) -= cStats (i) (attack)
                        etarget (target (i)) := i
                    else
                        ponygoing (i) := false
                    end if
                    if enemyalive (target(i)) = false then
                        hastarget (i) := false
                        targetx (i) :=  ponyposx (i)
                        targety (i) :=  ponyposy (i)
                    end if
                    if ponyposy (i)  > enemyy (target (i)) and hastarget (i) = true then
                        ponyposy (i) -=1
                        ponygoing (i) := true
                    elsif ponyposy (i) < enemyy (target (i)) and hastarget (i) = true then
                        ponyposy (i) +=1
                        ponygoing (i) := true
                    end if
                   
                elsif hastarget (i) =true and SelStats (i) (aclass) = 1 and SelStats (i) (cooldownatk) = 100 and shoot (i) = false then
                    SelStats (i) (cooldownatk) := 0
                    shoot (i) := true
                    ponyattacking (i) := true
                    projx (i) := ponyposx (i)
                    projy (i) := ponyposy (i)
                        targetx (i) :=  ponyposx (i)
                        targety (i) :=  ponyposy (i)
                    if enemyalive (target(i)) = false then
                        hastarget (i) := false
                        targetx (i) :=  ponyposx (i)
                        targety (i) :=  ponyposy (i)
                    end if
                   
                else
                    if ponyposx(i) > targetx (i) and ponyattacking (i) = false then
                        ponyposx (i) -=1
                        ponydir (i) := "left"
                        ponygoing (i) := true
                    elsif ponyposx (i)   < targetx (i) and ponyattacking (i) = false then
                        ponyposx (i) +=1
                        ponydir (i) := "right"
                        ponygoing (i) := true
                    else
                        ponygoing (i) := false
                    end if
                    if ponyposy(i) > targety (i) and ponyattacking (i) = false then
                        ponyposy (i) -=1
                        ponygoing (i) := true
                    elsif ponyposy(i) < targety (i) and ponyattacking (i) = false then
                        ponyposy (i) +=1
                        ponygoing (i) := true
                    end if
                end if
               
               
               
               
               
               
                put SelStats(i)(battlehp)
                Draw.FillBox (ponyposx(i)-Pic.Width (pics (i)(1)) div 2 -3,ponyposy(i) + Pic.Height (pics (i)(1))-3,ponyposx(i)+Pic.Width (pics (i)(1)) div 2 +3 ,ponyposy(i) + Pic.Height (pics (i)(1))+18,black)
                Draw.FillBox (ponyposx(i)-Pic.Width (pics (i)(1))div 2,ponyposy(i) + Pic.Height (pics (i)(1)), floor (SelStats(i)(battlehp) /SelStats(i)(hp))*Pic.Width (pics (i)(1)) div 2 + ponyposx(i)   ,ponyposy(i) + Pic.Height (pics (i)(1))+15,statrgb (1))
                Draw.FillBox (ponyposx(i)-Pic.Width (pics (i)(1))div 2 ,ponyposy(i) + Pic.Height (pics (i)(1))+13, floor (SelStats(i)(battlehp) /SelStats(i)(hp))*Pic.Width (pics (i)(1)) div 2 + ponyposx(i) ,ponyposy(i) + Pic.Height (pics (i)(1))+15,white)
                Sprite.Show (ponysprite (i))
                animatepony2 (1,selected(i),i)
                if shoot(i) = true then
                    if projx(i) > enemyx (target (i)) then
                        projx (i) -=9
                    elsif projx (i)   < enemyx (target (i)) then
                        projx (i) +=9
                    end if
                    if projy(i) > enemyy (target (i)) + Pic.Height (inpics (enemybase (target (i))) (1) (1)) div 2  then
                        projy (i) -=9
                    elsif projy(i) < enemyy (target (i)) + Pic.Height (inpics (enemybase (target (i))) (1) (1)) div 2 then
                        projy (i) +=9
                    end if
                    Draw.FillOval (projx (i), projy (i), 10,10,purple)
                    if projx (i) < enemyx (target (i)) + 21 and projx (i) > enemyx (target (i))  -21 and projy (i) < enemyy (target (i)) +21 + Pic.Height (inpics (enemybase (target (i))) (1) (1)) div 2 and projy (i) > enemyy (target (i)) -21 + Pic.Height (inpics (enemybase (target (i))) (1) (1)) div 2 then
                        fork cooldown ((i),true)
                        eSelStats (target(i)) (battlehp) -= cStats (i) (attack)
                        shoot (i) := false
                    end if
                end if
            end for
               
            for i : 1.. 3
                if mousex  < ponyposx(i) + Pic.Width (pics (i)(1)) div 2  and mousex > ponyposx (i) - Pic.Width (pics (i)(1)) div 2 and mousey > ponyposy (i) and mousey < ponyposy (i) + Pic.Height (pics (i)(1)) and lmb =1 then
                    ponynum := i
                elsif lmb = 1 and ponynum = i then
                    for k : 1.. 10
                        if mousex  < enemyx(k) + Pic.Width (inpics (enemybase(k))(1)(1)) div 2  and mousex > enemyx (k) - Pic.Width (inpics (enemybase(k))(1)(1)) div 2 and mousey > enemyy (k) and mousey < enemyy (k) + Pic.Height (inpics (enemybase(k))(1)(1)) then
                            target (ponynum) := k
                            hastarget (ponynum) := true
                            exit
                        else
                            hastarget (i) := false
                            targetx (i) := mousex
                            targety(i) := mousey
                           
                        end if
                    end for
                end if
            end for
                Draw.FillOval (ponyposx (ponynum),ponyposy(ponynum),45,11,50)
            Draw.FillOval (ponyposx (ponynum),ponyposy(ponynum),40,10,white)
            put "wave:"+intstr(wave)
            put shoot(ponynum)
            put projx (ponynum)
            put SelStats (ponynum) (aclass)
            View.Update
            delay(40)
            checkdeaths := 0
            for i : 1 ..10
                if enemyalive(i) = false then
                    checkdeaths += 1
                end if
            end for
                exit when checkdeaths = 10
           
           
        end loop
        for i : 1..10
           
            Sprite.Free (enemy(i))
        end for
           
        exit when wave = 11
    end loop
   
   
   
   
   
end Arena 
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  [ 7 Posts ]
Jump to:   


Style:  
Search: