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

Username:   Password: 
 RegisterRegister   
 Weird Little Problem
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Paul




PostPosted: Mon Feb 23, 2004 4:37 pm   Post subject: (No subject)

I meant erasing your character, cause its a bunch of pictures, also if you don't put and then it could meet the x conditions but not the y conditions, so it could turn red even though the sword is below the enemy but not in it. Also, the thing with the var test:=Pic.FileNew, I edited after you replied, and I also did the erasing character thing here, this code seems to work good for me:
code:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% The Ledgend of Janet: Tom's Story...
%%% Made by Nathan Boucher & Travis Baker...
%%% Feb. 17, 2004
%%% Version 0.3
%%% Use the arrow keys to move Tom around the screen and space to swing sword...
%%% Grade 10 Computer Sciences & Technologies...
%%% (c)2004 B&B Inc.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
setscreen ("graphics:500;500")
var test := Pic.FileNew ("test.bmp")
var l,m,x, y, key, ene, change : int
var xx, yy:int
var chars : array char of boolean
x := 180
y := 370
ene := 0
%How many keys he has.
key := 0
change := 5
loop
    View.Set ("offscreenonly")
    View.Update
    Input.KeyDown (chars)
        delay (5)
cls

    if chars (KEY_UP_ARROW) then
        y := y + change
yy:=y-10
else yy:=y
    end if
    if chars (KEY_RIGHT_ARROW) then
        x := x + change
xx:=x-10
else
xx:=x
    end if
    if chars (KEY_LEFT_ARROW) then
        x := x - change
xx:=x-10
else xx:=x
    end if
    if chars (KEY_DOWN_ARROW) then
        y := y - change
yy:=y-10
else yy:=y
    end if
    % if chars (' ') then
    %     l := l + change
    % elsif chars (' ') then
    %     m := m - 50
    % elsif chars ('w') then
    %     l -= 15
    % elsif chars ('w') then
    %     m += 50
    %end if
    %Right Wall Detection
    if x >= 407 then
        x -= change

    end if
    %Bototm wall detection
    if y <= 80 then
        y += change
    end if
    if x <= 40 then
        x += change
    elsif y <= 40 then
        y += change

    end if
    if y >= maxy - 95 then
        y -= change

    end if
    if y <= 275 then
        y += change
    end if

    %drawbox (49, 59, 451, 461, 0) %Wall boundry
    %drawbox (49, 280, 451, 461, 0) %Top part of level boundry
 
    Pic.ScreenLoad ("Zelda1.bmp", 0, 0, picCopy)
    Pic.Draw (test, x, y, picMerge)     
   

    %enemy
    drawfilloval (300, maxy - 75, 15, 15, 124)
    drawfilloval (285, maxy - 65, 5, 5, 4)
    drawfilloval (315, maxy - 65, 5, 5, 4)
    drawfilloval (300, maxy - 75, 5, 5, 17)
    drawbox (49, 280, 451, 461, 0)

%%%%%%%%BELOW HERE IS ENEMY DAMAGE FOR COMPSCI.CA%%%%%%%%%%
l:=x+45
m:=y+45
     if l >= 285 and l <= 315  and m >= maxy - 90 and m <= maxy - 60then
         ene := 1
     
     end if
     if ene = 1 then
         drawfilloval (300, maxy - 75, 15, 15, 12)
     end if
end loop

Sponsor
Sponsor
Sponsor
sponsor
TheFerret




PostPosted: Mon Feb 23, 2004 4:41 pm   Post subject: (No subject)

What are the xx and yy part of the code for... Is there a way to get the enemey to erase...
Paul




PostPosted: Mon Feb 23, 2004 4:56 pm   Post subject: (No subject)

Yea there is, this is a cool way I think, from borrowed Cervantes code
code:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% The Ledgend of Janet: Tom's Story...
%%% Made by Nathan Boucher & Travis Baker...
%%% Feb. 17, 2004
%%% Version 0.3
%%% Use the arrow keys to move Tom around the screen and space to swing sword...
%%% Grade 10 Computer Sciences & Technologies...
%%% (c)2004 B&B Inc.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
setscreen ("graphics:500;500")
var test := Pic.FileNew ("test.bmp")
var l,m,x, y, key, ene, change : int
var xx, yy:int
var chars : array char of boolean
x := 180
y := 370
ene := 0
%How many keys he has.
key := 0
change := 5
loop
    View.Set ("offscreenonly")
    View.Update
    Input.KeyDown (chars)
        delay (5)
cls

    if chars (KEY_UP_ARROW) then
        y := y + change
yy:=y-10
else yy:=y
    end if
    if chars (KEY_RIGHT_ARROW) then
        x := x + change
xx:=x-10
else
xx:=x
    end if
    if chars (KEY_LEFT_ARROW) then
        x := x - change
xx:=x-10
else xx:=x
    end if
    if chars (KEY_DOWN_ARROW) then
        y := y - change
yy:=y-10
else yy:=y
    end if
    % if chars (' ') then
    %     l := l + change
    % elsif chars (' ') then
    %     m := m - 50
    % elsif chars ('w') then
    %     l -= 15
    % elsif chars ('w') then
    %     m += 50
    %end if
    %Right Wall Detection
    if x >= 407 then
        x -= change

    end if
    %Bototm wall detection
    if y <= 80 then
        y += change
    end if
    if x <= 40 then
        x += change
    elsif y <= 40 then
        y += change

    end if
    if y >= maxy - 95 then
        y -= change

    end if
    if y <= 275 then
        y += change
    end if

    %drawbox (49, 59, 451, 461, 0) %Wall boundry
    %drawbox (49, 280, 451, 461, 0) %Top part of level boundry
 
    Pic.ScreenLoad ("Zelda1.bmp", 0, 0, picCopy)
    Pic.Draw (test, x, y, picMerge)     
   

    %enemy
    drawfilloval (300, maxy - 75, 15, 15, 124)
    drawfilloval (285, maxy - 65, 5, 5, 4)
    drawfilloval (315, maxy - 65, 5, 5, 4)
    drawfilloval (300, maxy - 75, 5, 5, 17)
    drawbox (49, 280, 451, 461, 0)

%%%%%%%%BELOW HERE IS ENEMY DAMAGE FOR COMPSCI.CA%%%%%%%%%%
l:=x+45
m:=y+45
var OR, clr:int:=1
     if l >= 285 and l <= 315  and m >= maxy - 90 and m <= maxy - 60then
         ene := 1
     
     end if
     if ene = 1 then
         drawfilloval (300, maxy - 75, 15, 15, 12)
         delay (50)
         View.Update
      for i : 1 .. 25
            OR :=1+i
            clr := Rand.Int (32, 125)
            Draw.Oval (300, maxy-75, OR, OR, clr)
           
            delay (3)
           View.Update
        end for
         for decreasing i : 25..1
            OR :=1+ i
            clr := Rand.Int (32, 125)
            Draw.Oval (300, maxy-75, OR, OR, white)
           
            delay (3)
           View.Update
           drawfilloval (300, maxy - 75, 15, 15, 0)
    drawfilloval (285, maxy - 65, 5, 5, 0)
    drawfilloval (315, maxy - 65, 5, 5, 0)
    drawfilloval (300, maxy - 75, 5, 5, 0)
    drawbox (49, 280, 451, 461, 0)
    Pic.Draw (test, x, y, picMerge)
        end for
exit
         end if
end loop
Paul




PostPosted: Mon Feb 23, 2004 5:03 pm   Post subject: (No subject)

Oh yea, and I suggest you replace the x and y's and the coordinates for the enemy with variables, this makes it easier to use in a bigger program. Right now it just exits after it kills the enemy, if this, you can have say...
the enemy respawns after it gets killed, just by changing the variable. And put it in a bigger loop or something.
the_short1




PostPosted: Mon Feb 23, 2004 11:08 pm   Post subject: (No subject)

cool start i think....

only maybe a bit too much to chew.... how many levels do you plan on adding???

Zelda is a long and complex game...

but your a young new recruit.,.,.,
U CAN DO IT!!!!
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 2 of 2  [ 20 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: