Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with platform game

Status
Not open for further replies.

fugigoose

Programmer
Jun 20, 2001
241
US
I am working on a platform game and it works fine when you run it once, but when you rewind the movie and start all over it doesn't work right. Sometimes if i move the scrollbars on the stage area it starts working again. It will run once fine but then i must exit director and reload it for it to work again. I think this has somethign to do with my scrolling the map instead of the character but i'm not sure. I'm scrolling it using a repeat with statement (to scroll all objects) Help!
 
THe first thing i would do is check to see all the variables are getting initialized properly. The situation ur describing is mostly likely coz of something remianing incomplete, some variable carrying over a bad value etc.
It's really quite difficult to figure out what's going wrong.

You gonna need some intense debugging.

Mayuresh
 
thanx, i'll try that. Do you have to preset a varible in a repeat with statement? And do you have to use a different one for each statement? Haven't used FOR statements much in the past.
 
Ok, after careful debugging i've found HOW it is not working but not why. For some reason if the scrollbar on the stage area is not all the way up, the varible that says if i'm on ground is set to 1. If i scroll the bar all the way to the top it goes to what it should be, 0, causing my guy to fall. This means either the varible cannot be set or my IF INSIDE statements are returning true when they shouldn't. Should the postion of the scrolbars effect the setting of varibles or the effectiveness of the INSIDE test? PLEEZ help me, i'm desperate. Heres the part that controls falling. 125 is the name of the character sprite.

--clip--
set ground = 0
set clipl = 0
set clipr = 0
repeat with i = 2 to 150
if i < 125 or i > 130 then
if sprite(125).right >= sprite(i).left and sprite(125).left <= sprite(i).right then
if inside(point(sprite(125).loch + 10, sprite(125).locv + sprite(125).height / 2), sprite(i).rect) then
ground = 1
end if

if inside(point(sprite(125).loch - 15, sprite(125).locv + sprite(125).height / 2), sprite(i).rect) then
ground = 1
end if
end if
----------
if inside(point(sprite(125).left + 40, sprite(125).bottom - 15), sprite(i).rect) then
clipl = 1
end if

if inside(point(sprite(125).left + 40, sprite(125).top + 15), sprite(i).rect) then
clipl = 1
end if

if inside(point(sprite(125).right - 40, sprite(125).bottom - 15), sprite(i).rect) then
clipr = 1
end if

if inside(point(sprite(125).right - 40, sprite(125).top + 10), sprite(i).rect) then
clipr = 1
end if

if inside(point(sprite(125).right, sprite(125).top), sprite(i).rect) then
jumppower = 0
jump = 0
end if

if inside(point(sprite(125).left, sprite(125).top), sprite(i).rect) then
jumppower = 0
jump = 0
end if

end if
end repeat
 
Ok, after careful debugging i've found HOW it is not working but not why. For some reason if the scrollbar on the stage area is not all the way up, the varible that says if i'm on ground is set to 1. If i scroll the bar all the way to the top it goes to what it should be, 0, causing my guy to fall. This means either the varible cannot be set or my IF INSIDE statements are returning true when they shouldn't. Should the postion of the scrolbars effect the setting of varibles or the effectiveness of the INSIDE test? PLEEZ help me, i'm desperate. Heres the part that controls falling. 125 is the name of the character sprite.

--clip--
set ground = 0
set clipl = 0
set clipr = 0
repeat with i = 2 to 150
if i < 125 or i > 130 then
if sprite(125).right >= sprite(i).left and sprite(125).left <= sprite(i).right then
if inside(point(sprite(125).loch + 10, sprite(125).locv + sprite(125).height / 2), sprite(i).rect) then
ground = 1
end if

if inside(point(sprite(125).loch - 15, sprite(125).locv + sprite(125).height / 2), sprite(i).rect) then
ground = 1
end if
end if
end repeat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top