Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / text adventure and images problem

Author
Message
wendy
12
Years of Service
User Offline
Joined: 16th Mar 2012
Location: Australia
Posted: 19th Mar 2012 11:06
hi im making a text adventure with images and withe mouse clicking to. i have my front cover that works fine then i click new game and that works fine then after my splashscreen finishs i click next and then thats fine but on my next screen i have a button that says back, now it goes back but it doesnt go back to the splash screen it goes back to the front cover which is my title. i hope you understood what im saying can any 1 help please because ive been searching forums for ages.
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 19th Mar 2012 22:40
Some code would be helpfull, it is impossible to say what or where your problem is without any code at all

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
wendy
12
Years of Service
User Offline
Joined: 16th Mar 2012
Location: Australia
Posted: 20th Mar 2012 03:13
sorry i thought i made it clear bare in mind i am a beginner so it may look messy ok this is the first time ever to upload code so i hope it works

`FUNCTIONS
`having problem with the play function
`the play function
Function play()

`clears the previous screen
cls

`loop
do


`clears any memory
cls

ink rgb(0,0,0),0


paste image IMG_FOREST, 0,y
`black
`top
line 200,48,601,48
`right side
line 602,550,602,49
`bottom

`top
line 200,49,601,49
`left side

`right side
line 601,550,601,49

`red
ink rgb(117,0,0),0
`bottom
line 200,550,600,550
`top
line 200,50,600,50
`left side
line 200,550,200,50
`right side
line 600,550,600,50

ink rgb(255,255,255),0
set text font "Arial"
set text size 18
`just getting mouse position after finish delete
text 0,0,"mousex = "+str$(mousex())+" "
text 0,20, "mousey = "+str$(mousey())+" "
text 0,60, "screen fps "+str$(screen fps())

set text font "Zombie"
set text size 27

if mousex()=>13 and mousey()=>528 and mousex()<=103 and mousey()<=580

ink rgb(0,0,0),0

text 33,553, "BACK"
ink rgb(183,0,0),0
text 30,550, "BACK"



if mouseclick()=1
splashscreen()

`text 0,40, "button hit"
`cls
endif
`splashscreen()
`endif
else

ink rgb(0,0,0),0

text 33,553, "BACK"
ink rgb(117,0,0),0
text 30,550, "BACK"

endif
`else
if mousex()=>355 and mousey()=>30 and mousex()<=417 and mousey()<=82
ink rgb(0,0,0),0
center text 398,53, "UP"
ink rgb(183,0,0),0
center text 395,50, "UP"
if mouseclick()=1
`text 0,40, "button hit"
`cls
`splashscreen()
endif
else
ink rgb(0,0,0),0
center text 398,53, "UP"
ink rgb(117,0,0),0
center text 395,50, "UP"
endif
if mousex()=>182 and mousey()=>237 and mousex()<=217 and mousey()<=409
ink rgb(0,0,0),0
center text 213,263, "L"
center text 213,303, "E"
center text 213,343, "F"
center text 213,383, "T"
ink rgb(183,0,0),0
center text 210,260, "L"
center text 210,300, "E"
center text 210,340, "F"
center text 210,380, "T"

if mouseclick()=0
set text font "Arial"
set text size 25
ink rgb(255,255,255),0
center text 390,20, "You can't go left. It's just a wall there."

endif
else
set text font "Zombie"
set text size 27
ink rgb(0,0,0),0
center text 213,263, "L"
center text 213,303, "E"
center text 213,343, "F"
center text 213,383, "T"
ink rgb(117,0,0),0
center text 210,260, "L"
center text 210,300, "E"
center text 210,340, "F"
center text 210,380, "T"
endif

if mousex()=>565 and mousey()=>237 and mousex()<=603 and mousey()<=451
ink rgb(0,0,0),0
center text 593,263, "R"
center text 593,303, "I"
center text 593,343, "G"
center text 593,383, "H"
center text 593,423, "T"
ink rgb(183,0,0),0
center text 590,260, "R"
center text 590,300, "I"
center text 590,340, "G"
center text 590,380, "H"
center text 590,420, "T"

if mouseclick()=0
set text font "Arial"
set text size 25
ink rgb(255,255,255),0
center text 390,20, "You can't go right. It's just a wall there."

endif
else
set text font "Zombie"
set text size 27
ink rgb(0,0,0),0
center text 593,263, "R"
center text 593,303, "I"
center text 593,343, "G"
center text 593,383, "H"
center text 593,383, "T"
ink rgb(117,0,0),0
center text 590,260, "R"
center text 590,300, "I"
center text 590,340, "G"
center text 590,380, "H"
center text 590,420, "T"
endif



paste image IMG_HEART, mousex(), mousey(), 1

`if you hit the m key you will bring up the map
`but you have to hold it down
if scancode()=50

`paste the map it covers whole screen
paste image IMG_MAP, 0, 0

`endif ends the if statement
endif
if inkey$()="p" then gosub pausemenu
`refresh the screen
sync

`ends the loop
loop

`ends the function command
EndFunction

Function splashscreen()
cls

set text font "Arial Bold"
set text size 18
INK RGB(117,0,0),0

do
cls
paste image IMG_FOREST, 0, y
`black
`top
line 200,48,601,48
`right side
line 602,550,602,49
`bottom

`top
line 200,49,601,49
`left side

`right side
line 601,550,601,49

`red
ink rgb(117,0,0),0
`bottom
line 200,550,600,550
`top
line 200,50,600,50
`left side
line 200,550,200,50
`right side
line 600,550,600,50

set text font "verdana"
set text size 20
gosub typing

ink rgb(255,255,255),0
set text font "Arial"
set text size 18
`just getting mouse position after finish delete
text 0,0,"mousex = "+str$(mousex())+" "
text 0,20, "mousey = "+str$(mousey())+" "
text 0,60, "screen fps "+str$(screen fps())

set text font "Zombie"
set text size 27
`paste image IMG_SPLASH, x, y, 1
`paste image IMG_SKULL, x, y, 1
if mousex()=>13 and mousey()=>528 and mousex()<=103 and mousey()<=580
ink rgb(0,0,0),0

text 33,553, "BACK"
ink rgb(183,0,0),0
text 30,550, "BACK"
if mouseclick()=1
`text 0,40, "button hit"
cls
menu()
endif
else
ink rgb(0,0,0),0

text 33,553, "BACK"
ink rgb(117,0,0),0
text 30,550, "BACK"
endif

if mousex()=>668 and mousey()=>532 and mousex()<=772 and mousey()<=576
ink rgb(0,0,0),0

text 693,553, "NEXT"
ink rgb(183,0,0),0
text 690,550, "NEXT"
if mouseclick()=1
`text 0,40, "button hit"
cls
play()
endif
else
ink rgb(0,0,0),0

text 693,553, "NEXT"
ink rgb(117,0,0),0
text 690,550, "NEXT"
endif


paste image IMG_HEART, mousex(), mousey(), 1

sync
LOOP
ENDFUNCTION
`the load game function
Function loadgame()

`clears the previous screen
cls

`loop
do

`clears any memory
cls
set text font "Arial"
set text size 18
ink rgb(255,255,255),0
text 0,0,"mousex = "+str$(mousex())+" "
text 0,20, "mousey = "+str$(mousey())+" "
text 0,60, "screen fps "+str$(screen fps())


`refresh the screen
sync
loop
EndFunction

`credit function
Function credit()


`clears the previous screen
cls

`loop
do


`clears any memory
cls


`paste the image at x and y coordinates
paste image IMG_PAPER, x, y
paste image IMG_HEART, mousex(), mousey(), 1
set text font "Arial"
set text size 18
ink rgb(255,255,255),0
text 0,0,"mousex = "+str$(mousex())+" "
text 0,20, "mousey = "+str$(mousey())+" "
text 0,60, "screen fps "+str$(screen fps())

set text font "Zombie"
set text size 60
INK RGB(0,0,0),0
center text 400,85,"CREDIT"
INK RGB(117,0,0) ,0
center text 386,80,"CREDIT"

set text font "Arial Bold"
set text size 18
INK RGB(0,0,0),0
text 385,190,"By"
text 335,230,"Wendy Morrison"
text 355,280,"Made With"
text 310,330,"DarkBasic Professional"


paste image IMG_SKULL, 180,50,1
paste image IMG_HEART,mousex(),mousey(),1

if mousex() > 190 and mousex() < 190 + image width(IMG_ARROW3) and mousey() > 400 and mousey() < 400 + image height(IMG_ARROW3)
paste image IMG_ARROW3S,190,400,1
paste image IMG_HEART,mousex(),mousey(),1
if mouseclick()=1
cls
menu()
endif
else
paste image IMG_ARROW3,190,400,1
endif
sync
loop
Endfunction

Function options()
cls

do
cls

paste image IMG_PAPER, x, y
set text font "Arial"
set text size 18
ink rgb(255,255,255),0
text 0,0,"mousex = "+str$(mousex())+" "
text 0,20, "mousey = "+str$(mousey())+" "
text 0,60, "screen fps "+str$(screen fps())
set text font "Zombie"
set text size 60
if mousex() > 450 and mousex() < 450 + image width(25) and mousey() > 200 and mousey() < 200 + image height(25)
paste image IMG_CHECKS, 450, 200, 1
paste image IMG_HEART, mousex(), mousey(), 1
if mouseclick()=1
`stop music 1
set window layout 0,0,0
maximize window
endif
if mouseclick()=1
`stop music 1
restore window
endif
else
paste image IMG_CHECK, 450, 200, 1
paste image IMG_HEART, mousex(), mousey(), 1
ENDIF
if mousex() > 190 and mousex() < 190 + image width(IMG_ARROW3) and mousey() > 400 and mousey() < 400 + image height(IMG_ARROW3)
paste image IMG_ARROW3S,190,400,1
paste image IMG_HEART,mousex(),mousey(),1
if mouseclick()=1
cls
menu()
endif
else
paste image IMG_ARROW3,190,400,1
endif
`music on and off
if mousex() > 450 and mousex() < 450 + image width(25) and mousey() > 280 and mousey() < 280 + image height(25)
paste image IMG_CHECKS, 450, 280, 1
paste image IMG_HEART, mousex(), mousey(), 1
if mouseclick()=1
`stop music 1

endif
else
paste image IMG_CHECK, 450, 280, 1
paste image IMG_HEART, mousex(), mousey(), 1
ENDIF
INK RGB(0,0,0),0
center text 400,85,"OPTIONS"
INK RGB(117,0,0) ,0
center text 386,80,"OPTIONS"

set text font "Arial Bold"
set text size 25
INK RGB(0,0,0),0
center text 330,200,"FullScreen On/Off"

center text 330,280,"Music Off/On"



paste image IMG_SKULL, 160,50,1
paste image IMG_HEART, mousex(), mousey(), 1

sync
loop
Endfunction


with the play function it goes to menu function instead of going
back the previous screen which is the splashscreen function


i know it really really messy im tidying it up when i can work it out

its also done entirely with text and i did have images but it still did the same problem thanks in advance
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 20th Mar 2012 05:42
To post code on the forum in a nice, tidy snippet box, click the CODE button (upper right corner), paste your code, and click the CODE button again.

As to answering your question, I find your code a little hard to follow. Typically, I use functions to perform one main task and will have one Main loop that calls the different functions / subroutines as needed. I would suggest that you reorganize it based upon these principles.

That said, my best guess is that before you respond to going back, put in a repeat - until loop to wait until the user lets go of the mouse button. It may be that it is indeed returning properly, but since the mouse button is still pressed, it goes back even further to the title screen. Here is an example:



So many games to code.......so little time.

wendy
12
Years of Service
User Offline
Joined: 16th Mar 2012
Location: Australia
Posted: 20th Mar 2012 06:29
thanx for reply i didnt know you had to click code twice
heres the code again hopefully neater but i dont know how i would reorganise cos i tried and my game messed up more and i tried the repeat and until it didnt work unless i had put them in wrong

`GAME MENU
FUNCTION menu()
hide mouse
do
paste image IMG_BACKGROUND, 0, 0
paste image IMG_TITLE, 0, 0, 1
set text font "Arial"
set text size 18
ink rgb(255,255,255),0
text 0,0,"mousex = "+str$(mousex())+" "
text 0,20, "mousey = "+str$(mousey())+" "
text 0,60, "screen fps "+str$(screen fps())
if mousex() > 280 and mousex() < 280 + image width(IMG_NEWGAME) and mousey() > 200 and mousey() < 200 + image height(IMG_NEWGAME)
paste image IMG_NEWGAMES, 280, 200, 1
paste image IMG_HEART, mousex(), mousey(), 1
if mouseclick()=1
splashscreen()
endif
else
paste image IMG_NEWGAME, 280, 200, 1
paste image IMG_HEART, mousex(), mousey(), 1
endif

if mousex() > 270 and mousex() < 270 + image width(IMG_LOADGAME) and mousey() > 270 and mousey() < 270 + image height(IMG_LOADGAME)
paste image IMG_LOADGAMES, 270, 270, 1
paste image IMG_HEART, mousex(), mousey(), 1
if mouseclick()=1
loadgame()
endif
else
paste image IMG_LOADGAME, 270, 270, 1
paste image IMG_HEART, mousex(), mousey(), 1
endif

if mousex() > 271 and mousex() < 271 + image width(IMG_OPTION) and mousey() > 340 and mousey() < 340 + image height(IMG_OPTION)
paste image IMG_OPTIONS, 271, 340, 1
paste image IMG_HEART, mousex(), mousey(), 1
if mouseclick()=1
options()
endif
else
paste image IMG_OPTION, 271, 340, 1
paste image IMG_HEART, mousex(), mousey(), 1
endif

if mousex() > 272 and mousex() < 272 + image width(IMG_CREDIT) and mousey() > 410 and mousey() < 410 + image height(IMG_CREDIT)
paste image IMG_CREDITS, 272, 410, 1
paste image IMG_HEART, mousex(), mousey(), 1
if mouseclick()=1
credit()
endif
else
paste image IMG_CREDIT, 272, 410, 1
paste image IMG_HEART, mousex(), mousey(), 1
endif

if mousex() > 272 and mousex() < 272 + image width(IMG_EXIT_EXIT) and mousey() > 480 and mousey() < 480 + image height(IMG_EXIT_EXIT)
paste image IMG_EXIT_EXITS, 272, 480, 1
paste image IMG_HEART, mousex(), mousey(), 1
if mouseclick()=1
end
endif
else
paste image IMG_EXIT_EXIT, 272, 480, 1
paste image IMG_HEART, mousex(), mousey(), 1
endif
`do the same as above if there is other buttons
sync
LOOP
EndFunction
`splash screen function
FUNCTION splashscreen()
cls
set text font "Arial Bold"
set text size 18
INK RGB(117,0,0),0
do
cls
paste image IMG_FOREST, 0, y
`black
`top
line 200,48,601,48
`right side
line 602,550,602,49
`top
line 200,49,601,49
`right side
line 601,550,601,49
`red
ink rgb(117,0,0),0
`bottom
line 200,550,600,550
`top
line 200,50,600,50
`left side
line 200,550,200,50
`right side
line 600,550,600,50

set text font "verdana"
set text size 20

gosub typing

ink rgb(255,255,255),0
set text font "Arial"
set text size 18
`just getting mouse position after finish delete
text 0,0,"mousex = "+str$(mousex())+" "
text 0,20, "mousey = "+str$(mousey())+" "
text 0,60, "screen fps "+str$(screen fps())

set text font "Zombie"
set text size 27

if mousex()=>13 and mousey()=>528 and mousex()<=103 and mousey()<=580
ink rgb(0,0,0),0
text 33,553, "BACK"
ink rgb(183,0,0),0
text 30,550, "BACK"
if mouseclick()=1
cls
menu()
endif
else
ink rgb(0,0,0),0
text 33,553, "BACK"
ink rgb(117,0,0),0
text 30,550, "BACK"
endif

if mousex()=>668 and mousey()=>532 and mousex()<=772 and mousey()<=576
ink rgb(0,0,0),0

text 693,553, "NEXT"
ink rgb(183,0,0),0
text 690,550, "NEXT"
if mouseclick()=1
play()
endif
else
ink rgb(0,0,0),0
text 693,553, "NEXT"
ink rgb(117,0,0),0
text 690,550, "NEXT"
endif
paste image IMG_HEART, mousex(), mousey(), 1

sync
LOOP
ENDFUNCTION

`the load game function
FUNCTION loadgame()
`clears the previous screen
cls
`loop
do
`clears any memory
cls
set text font "Arial"
set text size 18
ink rgb(255,255,255),0
text 0,0,"mousex = "+str$(mousex())+" "
text 0,20, "mousey = "+str$(mousey())+" "
text 0,60, "screen fps "+str$(screen fps())
`refresh the screen
sync
loop
ENDFUNCTION

FUNCTION options()
cls
do
cls
paste image IMG_PAPER, x, y
set text font "Arial"
set text size 18
ink rgb(255,255,255),0
text 0,0,"mousex = "+str$(mousex())+" "
text 0,20, "mousey = "+str$(mousey())+" "
text 0,60, "screen fps "+str$(screen fps())
set text font "Zombie"
set text size 60
if mousex() > 450 and mousex() < 450 + image width(25) and mousey() > 200 and mousey() < 200 + image height(25)
paste image IMG_CHECKS, 450, 200, 1
paste image IMG_HEART, mousex(), mousey(), 1
if mouseclick()=1
set window layout 0,0,0
maximize window
endif
if mouseclick()=1
restore window
endif
else
paste image IMG_CHECK, 450, 200, 1
paste image IMG_HEART, mousex(), mousey(), 1
endif

if mousex() > 190 and mousex() < 190 + image width(IMG_ARROW3) and mousey() > 400 and mousey() < 400 + image height(IMG_ARROW3)
paste image IMG_ARROW3S,190,400,1
paste image IMG_HEART,mousex(),mousey(),1
if mouseclick()=1
cls
menu()
endif
else
paste image IMG_ARROW3,190,400,1
endif
`music on and off
if mousex() > 450 and mousex() < 450 + image width(25) and mousey() > 280 and mousey() < 280 + image height(25)
paste image IMG_CHECKS, 450, 280, 1
paste image IMG_HEART, mousex(), mousey(), 1
if mouseclick()=1
endif
else
paste image IMG_CHECK, 450, 280, 1
paste image IMG_HEART, mousex(), mousey(), 1
endif
INK RGB(0,0,0),0
center text 400,85,"OPTIONS"
INK RGB(117,0,0) ,0
center text 386,80,"OPTIONS"

set text font "Arial Bold"
set text size 25
INK RGB(0,0,0),0
center text 330,200,"FullScreen On/Off"
center text 330,280,"Music Off/On"
paste image IMG_SKULL, 160,50,1
paste image IMG_HEART, mousex(), mousey(), 1

sync
loop
ENDFUNCTION

`credit function
FUNCTION credit()
`clears the previous screen
cls
`loop
do
`clears any memory
cls
`paste the image at x and y coordinates
paste image IMG_PAPER, x, y
paste image IMG_HEART, mousex(), mousey(), 1
set text font "Arial"
set text size 18
ink rgb(255,255,255),0
text 0,0,"mousex = "+str$(mousex())+" "
text 0,20, "mousey = "+str$(mousey())+" "
text 0,60, "screen fps "+str$(screen fps())

set text font "Zombie"
set text size 60
INK RGB(0,0,0),0
center text 400,85,"CREDIT"
INK RGB(117,0,0) ,0
center text 386,80,"CREDIT"

set text font "Arial Bold"
set text size 18
INK RGB(0,0,0),0
text 385,190,"By"
text 335,230,"Wendy Morrison"
text 355,280,"Made With"
text 310,330,"DarkBasic Professional"


paste image IMG_SKULL, 180,50,1
paste image IMG_HEART,mousex(),mousey(),1

if mousex() > 190 and mousex() < 190 + image width(IMG_ARROW3) and mousey() > 400 and mousey() < 400 + image height(IMG_ARROW3)
paste image IMG_ARROW3S,190,400,1
paste image IMG_HEART,mousex(),mousey(),1
if mouseclick()=1
cls
menu()
endif
else
paste image IMG_ARROW3,190,400,1
endif

sync
loop
ENDFUNCTION

`the play function
FUNCTION play()
`clears the previous screen
cls
`loop
do
`clears any memory
cls
`ink the shadow lines with black
ink rgb(0,0,0),0
`paste the background
paste image IMG_FOREST, 0,y
`top
line 200,48,601,48
`right side
line 602,550,602,49
`top
line 200,49,601,49
`right side
line 601,550,601,49
`red
ink rgb(117,0,0),0
`bottom
line 200,550,600,550
`top
line 200,50,600,50
`left side
line 200,550,200,50
`right side
line 600,550,600,50
`white color for text,and font and size of text
ink rgb(255,255,255),0
set text font "Arial"
set text size 18
`just getting mouse position and the frame rate after finish delete
text 0,0,"mousex = "+str$(mousex())+" "
text 0,20, "mousey = "+str$(mousey())+" "
text 0,60, "screen fps "+str$(screen fps())
`zombie font and size
set text font "Zombie"
set text size 27
`find the mouse over text position
if mousex()=>13 and mousey()=>528 and mousex()<=103 and mousey()<=580
`ink the shadow with black
ink rgb(0,0,0),0
text 33,553, "BACK"
`ink lighter red for the front text
ink rgb(183,0,0),0
text 30,550, "BACK"
`if you click on the word back it should go back to previous screen
if mouseclick()=1
`it goes back to the function splashscree
splashscreen()
`ends the mouse click statement
endif
else
`else it inks black shadow again
ink rgb(0,0,0),0
text 33,553, "BACK"
`it goes to the normal blood red color
ink rgb(117,0,0),0
text 30,550, "BACK"
`ends the mouse over text statement
endif

if mousex()=>355 and mousey()=>30 and mousex()<=417 and mousey()<=82
ink rgb(0,0,0),0
center text 398,53, "UP"
ink rgb(183,0,0),0
center text 395,50, "UP"
if mouseclick()=1
`put what function your clicking
endif
else
ink rgb(0,0,0),0
center text 398,53, "UP"
ink rgb(117,0,0),0
center text 395,50, "UP"
endif

if mousex()=>182 and mousey()=>237 and mousex()<=217 and mousey()<=409
ink rgb(0,0,0),0
center text 213,263, "L"
center text 213,303, "E"
center text 213,343, "F"
center text 213,383, "T"
ink rgb(183,0,0),0
center text 210,260, "L"
center text 210,300, "E"
center text 210,340, "F"
center text 210,380, "T"
if mouseclick()=1
set text font "Arial"
set text size 25
ink rgb(255,255,255),0
center text 390,20, "You can't go left. It's just a wall there."
endif
else
set text font "Zombie"
set text size 27
ink rgb(0,0,0),0
center text 213,263, "L"
center text 213,303, "E"
center text 213,343, "F"
center text 213,383, "T"
ink rgb(117,0,0),0
center text 210,260, "L"
center text 210,300, "E"
center text 210,340, "F"
center text 210,380, "T"
endif

if mousex()=>565 and mousey()=>237 and mousex()<=603 and mousey()<=451
ink rgb(0,0,0),0
center text 593,263, "R"
center text 593,303, "I"
center text 593,343, "G"
center text 593,383, "H"
center text 593,423, "T"
ink rgb(183,0,0),0
center text 590,260, "R"
center text 590,300, "I"
center text 590,340, "G"
center text 590,380, "H"
center text 590,420, "T"
if mouseclick()=1
set text font "Arial"
set text size 25
ink rgb(255,255,255),0
center text 390,20, "You can't go right. It's just a wall there."
endif
else
set text font "Zombie"
set text size 27
ink rgb(0,0,0),0
center text 593,263, "R"
center text 593,303, "I"
center text 593,343, "G"
center text 593,383, "H"
center text 593,383, "T"
ink rgb(117,0,0),0
center text 590,260, "R"
center text 590,300, "I"
center text 590,340, "G"
center text 590,380, "H"
center text 590,420, "T"
endif
`if you hit the m key you will bring up the map
`but you have to hold it down
if scancode()=50 then paste image IMG_MAP, 0, 0
`goes to pause but untill i work it out better you have to hold p key down
if inkey$()="p" then gosub pausemenu
`paste the cursor image
paste image IMG_HEART, mousex(), mousey(), 1
`refresh the screen
sync
`ends the loop
loop
`ends the function command
ENDFUNCTION


and i will try to upload my whole game just in case
i did press code twice dont know if it worked tho sorry if it didnt
ok just realize i have to use winrar to zip and then upload but if you do need to look please tell me and i will upload ok thanx
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 20th Mar 2012 12:46
Which function are you in when you press back and then go back to title instead of splashscreen? And which function is splashscreen? And the name of the cover title function? If you upload the code I will look into it later today.

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
wendy
12
Years of Service
User Offline
Joined: 16th Mar 2012
Location: Australia
Posted: 20th Mar 2012 14:13 Edited at: 21st Mar 2012 03:39
menu function is the front cover i click on new game image then it goes to the splashscreen which is the story then on the splashscreen i click on the next button which brings me to the play function then when i click on the back button it was meant to take me back to the splashscreen function but it goes straight back to the menu function instead its late here so i will upload the whole thing including the images tomorrow i have changed alot of things so decided not to have back but this is my second attempt to do this the first attempt did the same things and just skipped functions thanx for reply

i have put the file up for you to see what i mean but note i have 2 fonts you may not have which is zombie and suicide look at the function play() and the mouse control function for the play function the function that has back in it im having trouble with it thanx in advance

Attachments

Login to view attachments
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 21st Mar 2012 14:58 Edited at: 21st Mar 2012 15:01
There, I fixed it What happens is that when you press back from play, it actually goes to splashscreen but continues to menu because the mouse button is stille pressed when entering splashscreen so it activates menu in an instant. I added and modded these lines:

At the top add this, variables are local and not remembered across functions unless they are declared globals.


Here I set the variable to 1 just before calling splashscreen in the play_mouse_controls() function.


And finally I have changed this in the splashscreen_mouse_controls, menu() will not be called before mouse button 1 has been released which set stop_at_splashscreen to 0 again.


Hope this helps you I can upload your code again or you can make the changes yourself

EDIT: You will need these kind of things alot through out your game or else it will always happen when you have buttons at the same place in the screen you go to

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 21st Mar 2012 16:47
Quote: "There, I fixed it What happens is that when you press back from play, it actually goes to splashscreen but continues to menu because the mouse button is stille pressed when entering splashscreen so it activates menu in an instant."


Gee, I wish I would have thought of that.

Oh wait, I did:

Quote: "That said, my best guess is that before you respond to going back, put in a repeat - until loop to wait until the user lets go of the mouse button. It may be that it is indeed returning properly, but since the mouse button is still pressed, it goes back even further to the title screen."


So many games to code.......so little time.

Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 21st Mar 2012 21:34
Quote: "Gee, I wish I would have thought of that.

Oh wait, I did:

Quote: "That said, my best guess is that before you respond to going back, put in a repeat - until loop to wait until the user lets go of the mouse button. It may be that it is indeed returning properly, but since the mouse button is still pressed, it goes back even further to the title screen."
"


Sorry, but I did not notice your solution. Could you please provide a small piece of code with your implementation? It intrigues me

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
wendy
12
Years of Service
User Offline
Joined: 16th Mar 2012
Location: Australia
Posted: 21st Mar 2012 23:19 Edited at: 22nd Mar 2012 04:34
ok thanx for assistance it has all worked now

Login to post a reply

Server time is: 2024-11-23 20:46:00
Your offset time is: 2024-11-23 20:46:00