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 / crash&die

Author
Message
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 27th Dec 2005 03:35
i have a game were you fly around in a little ship and dodge things, how do i make it so when you hit somthing, you lose? i tried using cammands like object hit and putting an if infornt, but it gives me an erro0r, please help!!!!!!!

dont assume cause ull make an ass out of you and me!
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 27th Dec 2005 04:40
We need code to see whats wrong. Put it in code snips.

[ code ]
Your code here.
[ /code ]

Remove the spaces between the brackets and you see this:




flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 27th Dec 2005 04:46
hehe, dont luagh, im REALLY new and this might be horribly off.


that it just an example of what i did, i dont have that exact set up, but same idea

dont assume cause ull make an ass out of you and me!
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 27th Dec 2005 05:17
Quote: "hehe, dont luagh, im REALLY new and this might be horribly off."


Don't worry... we've all been there (most still are newbies in some areas).

The first thing I did was indent your code. Indenting makes it much easier to read (for yourself and others). You can see when loops start and end so you'll almost never have nesting errors. I just use one space for indenting but most use tabs. I used "sync rate 0" which sets syncing at the max speed of the computer running it and "sync on" to turn it on. Everytime "sync" is seen it updates the screen... this speeds up the programs because without "sync on" it automatically syncs everytime a change is made (which slows it down).

I made the objects a little bigger and moved them further away... they were way too close... one keypress and they would hit.

I got rid of "automatic object collision" because it pretty much does that already without those lines.

I changed "print" to "text" which gives you greater control over the text. With "print" if you wanted to change where it printed you'd have to use "set cursor" too... "text" does both "print" and "set cursor" in one command.

I got rid of the "goto" statement and moved the label into the if/then statement. There is no need to go outside of the do/loop just to do that if it ends right afterward. "goto" is an old command and really should be avoided. Use "gosub" because it has the ability to go back to the line after the gosub when it sees a "return.

Hope this helps.




flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 27th Dec 2005 05:26
like oh my god!!!! im so like impressed!!!!!!!!! sorry for that, i dont know why, but when i saw the HAHAHAHAHAHA part, i just got soooooooo happy, im not a girl , but felt like one .... THANK YOU SOOOOOO MUCH!!!!!!!!!!!! in my real game, i had the boxes furthur away and stuff, thats for the text to print tip too. and... thank you most of all for the collision stuff. NOW MY WORK ON BOX RAGE MAY CONTINUE!!!!!!!!!!! HAHAHAHAHAHAHAHA

dont assume cause ull make an ass out of you and me!
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 27th Dec 2005 05:44
It's ok to giggle like a little schoolgirl when your program runs right... I do.


flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 28th Dec 2005 02:20
hmm, it only works for two objects, i cant get it to work for 4!!!
1 ship
3 walls that surround the ship

dont assume cause ull make an ass out of you and me!
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 28th Dec 2005 04:03
Of course. To do the same thing multiple times you can use a for/next loop. The first loop this makes t=1 then t=2 and so on till t=4.




flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 28th Dec 2005 17:22
hmm. this is agrivating. I have a trench set up, and i applied your code instead of



there were stear control inthere too, but i didnt type them in. When i put in your code in place of that, I play the game, and goto lose... Does this mean i mst make the trench size bigger?
1-3 are the walls of the trench. 4 is you ship and 5 is a objsticle.

dont assume cause ull make an ass out of you and me!
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 28th Dec 2005 17:39
Alright, i didnt just edit the other one because i figured that out. You were right, the numbers had to be changed though.
this is a good example of that code

BUT!!!!! i tried putting it on my game. I had it before so that it would bounce you oppisite the side you hit. Exept i could only do that for the side walls, because i coulld get more that 2. I put your code in and made it so you just died if you hit a wall. Now, if you got to the bottam part, you go through it for a little, then you die!!! i just dontunderstand it , Charlie Brown
Here is the code i have for my game.


dont assume cause ull make an ass out of you and me!
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 28th Dec 2005 19:34
It could be your model thats causing that. The code itself seems to work fine.


flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 28th Dec 2005 22:32 Edited at: 28th Dec 2005 22:36
o poo. Oh well thanks, ill see what happens.

EDIT: oh my god. i am so fed up! everything to colse now or somthing because when i stat it, it waits 1 second and quits!!! im so pissed off at it.




and serious sam didnt save my game in atlatis, all the way from rome again!!!

dont assume cause ull make an ass out of you and me!

Login to post a reply

Server time is: 2024-09-24 11:29:54
Your offset time is: 2024-09-24 11:29:54