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 / need help with text and my building's collision too

Author
Message
Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 25th Apr 2010 08:26
Thanks for taking time to read this.

I'm trying to make a nice little game where you can go around a room, and talk to people. I've got a couple problems already:

First, I made a building with Cartography Shop and exported into my program. It looks great, but when I try to detect the collision, the program detects it as if it were a big box. How do I let the player go through the door but still stop when they hit the walls inside?

Second, I would like to make a Mario style text bubble, hopefully. I can handle the graphic design I think, but I don't have any idea how I could make the text slowly appear. I didn't say that very well, but here's some code of what I'm trying to do, except I'd like to do it more efficiently so I can have many sentences.



Thanks!!!!

Have a nice day, God Bless You!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 25th Apr 2010 14:54
You need arrays.



If you need to learn arrays, see tutorial number 1 here:

http://forum.thegamecreators.com/?m=forum_view&t=99497&b=10

TDK

Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 25th Apr 2010 15:18
If you want the text to appear one at a time you can try this.
Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 26th Apr 2010 03:04
wow, thanks! that works great. I could still use help for the other problem on my original post if anybody knows what to do.

Have a nice day, God Bless You!
Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 26th Apr 2010 16:16


I thought I'd post my code incase anybody's trying to benefit from this thread. I remmed out the media commands so you can just copy and paste it.

I will add some sliding collision and other stuff when I get the chance. It looks like there's an error when you talk to a sphere more than 3 times...

Have a nice day, God Bless You!
Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 26th Apr 2010 22:49
I've got another problem now. When trying to fit my text onto a coversation box, the program devides up the last word on every line. You will see it divide up "you" in my example.

I would like to make it so the program will "know" when it's on the last word and shift down a line. And I'd love to know if I'm doing anything else stupid too. thanks!!

sorry, my code's getting a little long. I tried to simplify it as much as possible.





Have a nice day, God Bless You!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 4th May 2010 06:42
Lol! Sorry, but that code is a bit of a mess!

For a start, the last line is 'Return', but where can you return to if you haven't got any Gosub anywhere in your program? You are simply corrupting the stack.

Unless of course, when you say "I tried to simplify it as much as possible" you mean you haven't posted all of your program - in which case helping to solve your program is virtually impossible as we have no idea what the missing code is doing.

Have you read tutorials 1 to 4 here?...

http://forum.thegamecreators.com/?m=forum_view&t=99497&b=10

They show you how to make 'modular' programs where each little task in your program is put into a separate subroutine and called from a Gosub in the main Do..Loop at the start of the program.

A couple of hours reading them will save you days or weeks of error tracing in the future - and will prevent you making most of the elementary mistakes you have in the code you just posted. (Once again, my comments are only if the code you posted is your whole program).

Never the less, if you split some of the things your code snippet does into smaller sections and put them in subroutines, you problems would be much easier to track down and fix.

The answer to your problem is:

1. Calculate the maximum pixel width for any line to stay inside the box.

2. Build up a string to print, one character at a time, remembering where the end of each word is until it reaches the width calculated in step 1.

3. If you are part way through a word at this point, backtrack to the end of the last word and then print it to the screen.

4. Continue steps 3 and 4 with the rest of the string stored in the array.

I think though that this is a little too advanced for you at this moment in time and you should read tutorial 7 here:

http://forum.thegamecreators.com/?m=forum_view&t=99497&b=10

When you fully understand the subject, check out this thread:

http://forum.thegamecreators.com/?m=forum_view&t=169384&b=1

which contains a function which does what you need.

TDK

Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 6th May 2010 20:56
alright, thanks TDK. I'll keep all that in mind. Sorry about my spaghetti code. I'll work through those tutorials when I get the chance.

Have a nice day, God Bless You!

Login to post a reply

Server time is: 2024-11-24 17:22:15
Your offset time is: 2024-11-24 17:22:15