Author |
Message |
sniper437
|
Posted: 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? [/code]
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
sniper437
|
Posted: Wed Nov 23, 2005 1:26 am Post subject: (No subject) |
|
|
woops forgot the pics
[/list]
Description: |
|
Filesize: |
876 Bytes |
Viewed: |
1815 Time(s) |
![mg1.JPG mg1.JPG](uploads/attachments/mg1.jpg)
|
Description: |
|
Filesize: |
876 Bytes |
Viewed: |
1815 Time(s) |
![mg1.JPG mg1.JPG](uploads/attachments/mg1.jpg)
|
|
|
|
|
|
![](images/spacer.gif) |
sniper437
|
Posted: Wed Nov 23, 2005 1:27 am Post subject: (No subject) |
|
|
wtf? my other one didnt come up?
Description: |
|
Filesize: |
2.85 KB |
Viewed: |
1816 Time(s) |
![ch2.jpg ch2.jpg](uploads/attachments/ch2.jpg)
|
Description: |
|
Filesize: |
2.85 KB |
Viewed: |
1814 Time(s) |
![ch2.jpg ch2.jpg](uploads/attachments/ch2.jpg)
|
|
|
|
|
|
![](images/spacer.gif) |
Albrecd
|
Posted: 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.
|
|
|
|
|
![](images/spacer.gif) |
do_pete
![](http://i38.photobucket.com/albums/e112/do_pete/1943.gif)
|
Posted: 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.
|
|
|
|
|
![](images/spacer.gif) |
Albrecd
|
Posted: 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)
|
|
|
|
|
![](images/spacer.gif) |
|