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

Username:   Password: 
 RegisterRegister   
 Game help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Talion




PostPosted: Sun Jan 15, 2006 9:35 am   Post subject: Game help

Alright i'm trying to make a game here with a fighting system. Now I can make the maps and characters and their stats and such but my battle system wont work. Atm I've scrapped it entirely and now am trying to rebuild it. It's not working though and i've been at it for ages so I've come to ask for some help.

The problems I have are that
A)you can only attack once with a button before it simply stops working
and
B) I can't make it so that if you kill the enemy it says they die but if you dont kill them it says it's their turn. (I haven't added in the enemies turn yet though...since i've noticed it says they die no matter what)

code:
var mousex, mousey, mouseb : int
var winID : int
var button1, button2, button3, button4, button5, button6, button7 : int
var input : int := 0
type charstats :
    record
        Name : string
        Level : int
        MaxHP : int
        CurHP : int
        Class : string
        Race : string
        ATK : int
        DEF : int
        Spells : string
        EXP : int
        MaxMP : int
        CurMP : int
        Weapon : string
        WPower : int
    end record
var stat : array 1 .. 1 of charstats

type Enemstats :
    record
        Name : string
        Level : int
        MaxHP : int
        CurHP : int
        ATK : int
        DEF : int
        Weapon : string
    end record
var Estat : array 1 .. 15 of Enemstats

Estat (1).Name := 'Robo Scout'
Estat (1).Level := 1
Estat (1).MaxHP := 10
Estat (1).CurHP := Estat (1).MaxHP
Estat (1).ATK := 1
Estat (1).DEF := 1
Estat (1).Weapon := 'probe'

Estat (2).Name := 'Gremlin'
Estat (2).Level := 2
Estat (2).MaxHP := 15
Estat (2).CurHP := Estat (2).MaxHP
Estat (2).ATK := 6
Estat (2).DEF := 8
Estat (2).Weapon := 'cackle'

proc Pstats
    for i : 1 .. 1
        put "Enter your Name"
        get stat (i).Name : *
        cls
        put "Enter your Race"
        put "Human" : 10, "Elf" : 10, "Dwarf" : 10
        put "Ogre" : 10, "Sprite" : 10, "shifter" : 10
        get stat (i).Race : *
        cls
        loop
            put "Enter your class"
            put "Warrior" : 14, "Archer" : 14, "Mage" : 14, "Thief"
            get stat (i).Class
            cls
            if stat (i).Class = 'warrior' or stat (i).Class = 'Warrior' then
                stat (i).WPower := 5
                stat (i).MaxHP := 35
                stat (i).CurHP := stat (i).MaxHP
                stat (i).Weapon := 'sword'
                stat (i).ATK := 10
                stat (i).DEF := 5
                stat (i).MaxMP := 0
                stat (i).CurMP := 0
                stat (i).Spells := 'N/a'
                stat (i).EXP := 0
                stat (i).Level := 1
                exit
            elsif stat (i).Class = 'archer' or stat (i).Class = 'Archer' then
                stat (i).WPower := 4
                stat (i).MaxHP := 25
                stat (i).CurHP := stat (i).MaxHP
                stat (i).Weapon := 'Bow'
                stat (i).ATK := 8
                stat (i).DEF := 7
                stat (i).MaxMP := 0
                stat (i).CurMP := 0
                stat (i).Spells := 'N/a'
                stat (i).EXP := 0
                stat (i).Level := 1
                exit
            elsif stat (i).Class = 'mage' or stat (i).Class = 'Mage' then
                stat (i).WPower := 2
                stat (i).MaxHP := 15
                stat (i).CurHP := stat (i).MaxHP
                stat (i).Weapon := 'staff'
                stat (i).ATK := 2
                stat (i).DEF := 4
                stat (i).MaxMP := 9
                stat (i).CurMP := 9
                stat (i).Spells := 'N/a'
                stat (i).EXP := 0
                stat (i).Level := 1
                exit
            elsif stat (i).Class = 'thief' or stat (i).Class = 'Thief' then
                stat (i).WPower := 3
                stat (i).MaxHP := 20
                stat (i).CurHP := stat (i).MaxHP
                stat (i).Weapon := 'daggers'
                stat (i).ATK := 8
                stat (i).DEF := 7
                stat (i).MaxMP := 0
                stat (i).CurMP := 0
                stat (i).Spells := 'N/a'
                stat (i).EXP := 0
                stat (i).Level := 1
                exit
            else
                put "No, no NO! I cannot teach you in that class..."
            end if
        end loop
        put "Name:", stat (i).Name
        put "Level:", stat (i).Level
        put "HP:", stat (i).CurHP, "/", stat (i).MaxHP
        put "Race:", stat (i).Race
        put "Class:", stat (i).Class
        put "Weapon:", stat (i).Weapon
        put "ATK:", stat (i).ATK
        put "DEF:", stat (i).DEF
        put "Magic Points:", stat (i).CurMP, "/", stat (i).MaxMP
        put "Spells: ", stat (i).Spells
        put "Experience:", stat (i).EXP
    end for
    delay (2000)
end Pstats

proc battlecore
    var font : int
    font := Font.New ('Arial:30')
    winID := Window.Open ('position:200;200,graphics:800;500,nobuttonbar,center,center')
    Font.Draw ('Battle Mode', maxx div 3, maxy - 30, font, black)
    var i : int := Rand.Int (1, 2)
    locatexy (550, maxy - 70)
    put Estat (i).Name
    locatexy (50, 120)
    put stat (1).Name
    locatexy (50, 100)
    put "Level: ", stat (1).Level
    locatexy (50, 90)
    put "Hit Points: ", stat (1).CurHP, "/", stat (1).MaxHP
    locatexy (30, 20)
    put "Attack"
    locatexy (130, 20)
    put "Defend"
    locatexy (250, 20)
    put "Magic"
    locatexy (345, 20)
    put "Inventory"
    locatexy (460, 20)
    put "Companion"
    locatexy (570, 20)
    put "Run Away"
    loop
        drawbox (10, 10, 100, 40, black)
        drawbox (110, 10, 210, 40, black)
        drawbox (220, 10, 320, 40, black)
        drawbox (330, 10, 430, 40, black)
        drawbox (440, 10, 540, 40, black)
        drawbox (550, 10, 650, 40, black)
        mousewhere (mousex, mousey, mouseb)
        if mousex >= 10 and mousex < 100 and mousey >= 10 and mousey < 40 and mouseb = 1 then
            var j : int := Rand.Int (stat (1).ATK - 3, stat (1).ATK + 3)
            var atkpower : int
            var dmg : int := 0
            atkpower := j + stat (1).WPower
            dmg := atkpower - Estat (i).DEF
            if Estat (i).CurHP >= 1 and dmg >= 1 then
                locatexy (0, maxy - 50)
                put "You hit ", Estat (i).Name, " for ", dmg, "dmg!!"
                Estat (i).CurHP := Estat (i).CurHP - dmg
                if Estat (i).CurHP <= 0 then
                    locatexy (0, maxy - 80)
                    put "You have slain ", Estat (i).Name, "!!!"
                elsif Estat (i).CurHP > 0 then
                    locatexy (0, maxy - 80)
                    put Estat (i).Name, "'s turn!"
                end if
            elsif Estat (i).CurHP >= 1 and dmg < 1 then
                locatexy (0, maxy - 50)
                put Estat (i).Name, " evaded your attack!"
                Estat (i).CurHP := Estat (i).CurHP
            end if
        elsif mousex >= 110 and mousex < 210 and mousey >= 10 and mousey < 40 and mouseb = 1 then
            locatexy (0, maxy - 80)
            put "testing..."
        elsif mousex >= 220 and mousex < 320 and mousey >= 10 and mousey < 40 and mouseb = 1 then
            locatexy (0, maxy - 80)
            put "test 2..."
        elsif mousex >= 330 and mousex < 430 and mousey >= 10 and mousey < 40 and mouseb = 1 then
            locatexy (0, maxy - 80)
            put "test 3..."
        elsif mousex >= 440 and mousex < 540 and mousey >= 10 and mousey < 40 and mouseb = 1 then
            locatexy (0, maxy - 80)
            put "test 4..."
        elsif mousex >= 550 and mousex < 650 and mousey >= 10 and mousey < 40 and mouseb = 1 then
            locatexy (0, maxy - 80)
            put "test 5..."
        end if
    end loop
end battlecore
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Pstats
battlecore


So can anyone help me out here?
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: