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

Username:   Password: 
 RegisterRegister   
 cls and then what?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
sniper437




PostPosted: Tue Nov 22, 2005 11:57 pm   Post subject: cls and then what?

okay im trying to make a text rpg and i gotta problem see i have this code:

code:


var picID : int
var picID1 : int
var mg1x : int := 100
var mg1y : int := 100
var x, y : int := 100
x := 120
y := 125
var chars : array char of boolean
picID := Pic.FileNew ("ch2.jpg")
picID1 := Pic.FileNew ("mg1.jpg")

loop

    Pic.Draw (picID, x, y, picMerge)
    Pic.Draw (picID1, mg1x, mg1y, picMerge)

    Input.KeyDown (chars)

    if chars (KEY_UP_ARROW) then
        y := y + 3
    end if
    if chars (KEY_RIGHT_ARROW) then
        x := x + 3
    end if
    if chars (KEY_LEFT_ARROW) then
        x := x - 3
    end if
    if chars (KEY_DOWN_ARROW) then
        y := y - 3
    end if
    delay (10)

   
    if (y <= mg1y +5) & (y >= mg1y -5) & (x <= mg1x +5) & (x >= mg1x -5) then
    cls
   y := 0
   x := 0
   Pic.Free (picID1)
   
   end if
   
    cls
end loop

   
    Pic.Free (picID)

so what i want to do now is that if my charater hits that mage i dont want to reset position i want it to clear the screen and bring up a brand new screen with like battle options, so how do i do it? Embarassed [/code]
Sponsor
Sponsor
Sponsor
sponsor
sniper437




PostPosted: Wed Nov 23, 2005 1:26 am   Post subject: (No subject)

woops forgot the pics Embarassed

[/list]



mg1.JPG
 Description:
this one
 Filesize:  876 Bytes
 Viewed:  1816 Time(s)

mg1.JPG



mg1.JPG
 Description:
this one and...
 Filesize:  876 Bytes
 Viewed:  1816 Time(s)

mg1.JPG


sniper437




PostPosted: Wed Nov 23, 2005 1:27 am   Post subject: (No subject)

wtf? my other one didnt come up?

Confused



ch2.jpg
 Description:
weirrddd
 Filesize:  2.85 KB
 Viewed:  1817 Time(s)

ch2.jpg



ch2.jpg
 Description:
 Filesize:  2.85 KB
 Viewed:  1815 Time(s)

ch2.jpg


Albrecd




PostPosted: Wed Nov 23, 2005 1:34 pm   Post subject: (No subject)

The reason that the window closes when you hit the other character is because it frees the picture but then continues the loop. Part of the loop is drawing the picture that you just freed, which it can no longer do. This causes an error. You need it to exit the loop as well as free the picture when they collide.
do_pete




PostPosted: Wed Nov 23, 2005 1:38 pm   Post subject: (No subject)

you would have to clear the screen and exit the loop and then have another loop with all the stuff you want. And use View.Update to get rid of the flicker.
Albrecd




PostPosted: Wed Nov 23, 2005 1:43 pm   Post subject: (No subject)

Or, within your loop, you could put:

code:

if %collision dection here% then
%Process with battle stuff here%
end if


and then continue the loop

(I would have edited my post but for some reason there was no edit button)
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  [ 6 Posts ]
Jump to:   


Style:  
Search: