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.

DarkBASIC Discussion / movement trouble

Author
Message
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 11th May 2007 03:40
i can't figure out what's going on with my cube, it won't go up when i prompt it to. i'm sure its something obvious but could someone else look at it real quick while i keep testing it? please?


thank you
zombie

TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 11th May 2007 04:05
1. Move moves the cube in the direction it is pointing. Upkey doesn't mean move an object up.

2. It has to be in a loop for the Upkey to work. You aren't using a loop.

3. The cube doesn't move because it's object 2. You are moving object 1 when you press the upkey.

4. Well, you would be if you were using UpKey() properly - it should be If UpKey()=1 - not 2!

5. Moving anything -1 moves it backwards not forwards-

6. Unless you press the upkey within a fraction of a second, the program has gone past it and is sitting at the Wait Key.

7. Also, you can't use Sync Rate 30 if you've not turn Sync on!

8. And without a Sync in the loop you won't see any screen updates.

9. You shouldn't have turned the backdrop off.

10. You shoiuld have grabbed the star screen as a texture and textured the backdrop with it.

Not bad - 10 problems in such a short snippet!

Fixed version:



Finally, what on earth is that style of indentation you are using? It's insane!! Lol...

TDK_Man

Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 11th May 2007 06:01
i don't know whether i should be proud or ahamed tdk. thank you for helping me out . And i've never indented like that before, i was pretty much just typing as i went.

but hey, thank you again and i think i've set some sort of record lol.

TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 11th May 2007 07:32
No problem - it actually made me smile when I looked at it!

TDK_Man

zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 11th May 2007 07:56 Edited at: 11th May 2007 23:23
Note:

1. You should also use the command randomize timer() before your rnd() functions so that it's randomly seeded. Without it I believe you are getting the same random sky every time you run it.

2. @TDK, in 2d moving a sprite for instance -1 in y values does in fact move it up on the screen.
[edit] just noticed you said fowards and backwards, not up and down, so I take number 2. back. Thought I had ya! lol


That's all that I spot.

Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 11th May 2007 08:03
thank you.. i'll put it in now

Login to post a reply

Server time is: 2026-07-05 22:39:35
Your offset time is: 2026-07-05 22:39:35