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 / Getting out of a Loop

Author
Message
SikofSin
14
Years of Service
User Offline
Joined: 26th Nov 2009
Location:
Posted: 26th Nov 2009 16:53
I've been messin around with game creation for a few years now. Just recently, however, I started with the more complex programming software,(Like Dark Basic), where you have to know more than just how to use someone's drag and paste methods. I have found that there is only so much you can do with such programs, unless you can change the engine itself, which DBPro allows you to do.

Anyway, I'm no rocket scientist, so I'm having a hard time with something. What I'm attempting to do is go from my Intro Movie to my Main Menu (Title Screen) of the game. What I find strange is that I can get both things to work individually. I just can't seem to link them together.

This is very basic, I know. But what is the best way to jump from one loop to the next?

As it stands, the video plays and when spacebar is pressed, it's supposed to jump to the Main Menu, but doesn't. Also, if the video runs til the end, it needs to go to the Main Menu, but doesn't.

It gets hung up on lines 7-9

Here's the Code


Rem Setup for CWIntro
Sync On
Sync Rate 40
Load Animation "media/CWIntro.wmv",1
Play Animation 1
Do
Print "Press Spacebar to Skip"
If SpaceKey()=1 then GOTO MainMenu
Sync
Loop
Mainmenu:
Set Display Mode 800,600,32
Rem Load the MainMenu Screen
Load Image "MainMenu2.jpg",1
Paste Image 1,0,0

If it pleases the court, I'd like to withdraw that statement. . .
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 26th Nov 2009 19:04
Any time you want to leave a loop you can use the EXIT command. It'll take you to the line under LOOP... no labels needed.



IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Nov 2009 20:26
Or in this case, you should switch to a REPEAT...UNTIL or WHILE...ENDWHILE loop.

SikofSin
14
Years of Service
User Offline
Joined: 26th Nov 2009
Location:
Posted: 27th Nov 2009 16:55

Rem Example 1 - Simple On-Screen Clickable Mouse Regions
Rem From TDK_Man's Tutorial On Menu Screens

Set Display Mode 800,600,32
Sync On: Sync Rate 60

Load Image "Screen1.jpg",1
Paste Image 1,0,0
Set Text Opaque

Do
Loop
End


I took this segment of script from a tutorial on how to create Title Screens. What I have taken out of the script, is the part about making the mouse work to select the buttons displayed thereon. What I don't get, is that if I run this with the here-missing part in, it works, but if I run it like this, it doesn't.

Does the program "paste" the image at ONE spot, represented by the "0,0" coordinates in the script? And if so, does that mean I will have to somehow paint the jpg file like a texture onto the screen? I guess I was under the understanding that the textures were for 3D objects only. And that you could manipulate the screen without having to go through the texture process by using 2D bmps and jpgs.

I'll probably end up making this thread very long. I'll try not to post very many separate posts, as I don't want to clog things up. The thing is, I just started programming for fun. I don't have degrees in the field or anything. So, I'll probably ask alot of questions until I give up, or complete a project.

Thanks in advance for the help so far and for future aidings.

If it pleases the court, I'd like to withdraw that statement. . .

Login to post a reply

Server time is: 2024-09-28 12:25:26
Your offset time is: 2024-09-28 12:25:26