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 / I need help!

Author
Message
IceCube
19
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: Munich, Germany
Posted: 31st May 2005 03:17
In my program I've loaded a image, and I want to move the picture right when I press the rightkey and I want to move the picture left if I press the leftkey, but I don't know how to do.

Can someone help me?
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 31st May 2005 08:56
I'm not sure since I haven't worked with images, but this might work.

it works for objects like boxes and cubes.

-"I'm over twice as strong as I was when we last met"-
-"Good, Twice the fall, double the glory"-
James Morgan
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location: Behind you
Posted: 31st May 2005 09:02
you can also load the images as a sprite and do the same as what Time Splitter suggested, just rather than
use


James

Hello!
master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 31st May 2005 14:45
You can also make it go into 3D, but keep the picture by doing something like this:












[img]load image "(name of image)",1
make object plain 1,(sizex),size(y)
position object 1,0,0,0
texture object 1,1

do
if rightkey()=1 then dec x#,1
if leftkey()=1 then inc x#,1
position object 1,x#,0,0
loop[/img]

______________________________________
<<<<I can program using anything>>>>
IceCube
19
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: Munich, Germany
Posted: 1st Jun 2005 00:08
I can't move it!

Thats my source code and with this source code I can't move it.
IceCube
19
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: Munich, Germany
Posted: 1st Jun 2005 00:28
OK. Now it moves, but I still have a problem.

When I'm moving the bat it leaves a trace behind it. How can I resolve it?

Attachments

Login to view attachments
master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 1st Jun 2005 07:37
Use my code snippet from before, but make the right key inc x by 5, no -5.

______________________________________
<<<<I can program using anything>>>>
IceCube
19
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: Munich, Germany
Posted: 2nd Jun 2005 00:59
Damn!

Now the display is black with this code!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 2nd Jun 2005 02:39
Put a sync command just before the loop command. You're just not updating the display after movement takes place.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk
IceCube
19
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: Munich, Germany
Posted: 2nd Jun 2005 23:54
OK. Now it's ok, but I liked the version with just the picture better.

Can't I remove the trace?
IceCube
19
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: Munich, Germany
Posted: 3rd Jun 2005 05:24
Can't anybody help me?
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 3rd Jun 2005 06:04
Dont bump you own post in the same day, maybe the person who is able to answer your question is in a different time zone and hasnt woken up yet.

Dodo
20
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 3rd Jun 2005 06:23 Edited at: 3rd Jun 2005 06:23
perhaps using a sprite would be a better option, something like this:



Part of solving the problem is actually noticing that the problem is there in the first place

NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 3rd Jun 2005 11:17
Dark Man,

Use the sync command along with the cls(clear screen) command. Sync updates the screen and cls clears it of any graphics. Try this code, with your image.



Always remember to update the screen with the new information, using sync, before clearing it with cls. If cls is placed before sync and after any information needed to be displayed on the screen, then the screen will be blank.


+NanoBrain+
IceCube
19
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: Munich, Germany
Posted: 3rd Jun 2005 22:20
Thanks! Now it works fine!
IceCube
19
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: Munich, Germany
Posted: 4th Jun 2005 23:12
Now I've got another problem.

I have got the bat and the ball,when the Ball hits the bat it bounces back and if I move the bat to the left side of the Screen and the Ball hits the Y Coordinate of the bat it bounces back,too! I only want the ball bouncing back when it hits just the bat.

This is my code so far:

Login to post a reply

Server time is: 2024-09-23 21:22:33
Your offset time is: 2024-09-23 21:22:33