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 / Continual Movement

Author
Message
The Game Programmer
19
Years of Service
User Offline
Joined: 4th Dec 2004
Location: Sitting, and waiting, and staring, and..
Posted: 21st Jan 2005 09:14
I"m trying to make my sprite move up and down continually. THe code I have is


The only problem is, when the sprite gets to the top it stops, and I want it to start going down again. Any advice?

Well, I'm trying aren't I.....

When Life gives you lemons make orange juice. Then sit back and wonder how it was done.
MSon
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 21st Jan 2005 09:22 Edited at: 21st Jan 2005 09:27
Would this Work?

Or
The Game Programmer
19
Years of Service
User Offline
Joined: 4th Dec 2004
Location: Sitting, and waiting, and staring, and..
Posted: 21st Jan 2005 09:29
Uh, but the sprite doesn't move up, at all ever. Let me put all my code in, I went ahead and remmed out my original movement code, but I must say it worked better than your version, any other ideas?

Well, I'm trying aren't I.....

When Life gives you lemons make orange juice. Then sit back and wonder how it was done.
The Game Programmer
19
Years of Service
User Offline
Joined: 4th Dec 2004
Location: Sitting, and waiting, and staring, and..
Posted: 21st Jan 2005 19:20
Sorry, but for neither of those does it work correctly. There's actually no movement at all...

Well, I'm trying aren't I.....

When Life gives you lemons make orange juice. Then sit back and wonder how it was done.
The Game Programmer
19
Years of Service
User Offline
Joined: 4th Dec 2004
Location: Sitting, and waiting, and staring, and..
Posted: 22nd Jan 2005 03:49
Um, I hate to keep posting but I haven't recieved any help yet (that works that is) (thanks for trying MSon)

I've modified my code to try and work and I have

I'm sorry I'm being such a pest about this, its just that this has been bugging me for a while, and even though I have been fixing other things up this is sortof a critical thing.

Well, I'm trying aren't I.....

When Life gives you lemons make orange juice. Then sit back and wonder how it was done.
Cryptoman
20
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 22nd Jan 2005 04:07
Here maybe this will help. Added a flag called Direction:1=down,0=up



set direction= to the direction you wish it to start moving at the beginning of your program.

Sample:


hope it helps


The Game Programmer
19
Years of Service
User Offline
Joined: 4th Dec 2004
Location: Sitting, and waiting, and staring, and..
Posted: 22nd Jan 2005 04:25
Oh thankyou. That works perfectly, exactly what I wanted. Thankyou so much. I don't know how to thankyou. And it really makes sense to me. Thankyou! I"m happy now.

Well, I'm trying aren't I.....

When Life gives you lemons make orange juice. Then sit back and wonder how it was done.
Cryptoman
20
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 22nd Jan 2005 08:29
You are welcome. Of course that's not the best example, but I kept it simple so you could understand the logic of it. Flags are useful, although some people would rather write 20 lines of never ending IF's(never understood the never ending IF's), flags make a large program easier to track for me.


The Game Programmer
19
Years of Service
User Offline
Joined: 4th Dec 2004
Location: Sitting, and waiting, and staring, and..
Posted: 22nd Jan 2005 12:07
Um, what exactly do you mean by "flags?" The code works but I don't know what you mean by "flag."

Well, I'm trying aren't I.....

When Life gives you lemons make orange juice. Then sit back and wonder how it was done.
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 22nd Jan 2005 18:25
A flag is usually a variable that can either be one thing or another. So in your case, the "flag" variable is either "up" or "down". You can use this in lots of different ways. They could aslo be called "boolean" variables, as they hold a value of 0 or 1 only.
(In dbp you can declare a variable as boolean by doing

This means that the memory allocated for that variable will be less, as the computer knows you only want to store a maximum of one number in it.)


http://www.dbspot.com/NYC
New years competition... Fo Shizzle.
The Game Programmer
19
Years of Service
User Offline
Joined: 4th Dec 2004
Location: Sitting, and waiting, and staring, and..
Posted: 22nd Jan 2005 23:17
Wow, that's interesting, and extremely useful in the code. Thank's again Trs80 Model2, and thanks redeye for the info, I'll use it.

Well, I'm trying aren't I.....

When Life gives you lemons make orange juice. Then sit back and wonder how it was done.
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 23rd Jan 2005 02:12
Seems the question is already answered, but here's another approach which would make the object move up and down smoothly;




The Game Programmer
19
Years of Service
User Offline
Joined: 4th Dec 2004
Location: Sitting, and waiting, and staring, and..
Posted: 23rd Jan 2005 07:14
I guess that would also work. Thank you Ric.

Well, I'm trying aren't I.....

When Life gives you lemons make orange juice. Then sit back and wonder how it was done.

Login to post a reply

Server time is: 2024-09-23 10:24:48
Your offset time is: 2024-09-23 10:24:48