|
-
Apr 14th, 2002, 02:50 AM
#1
Thread Starter
Member
Making a Timer Move a picture Multiple Directions (EX:up then down then left then up)
I have an image, ts called Img1, once I press the CmdStart button, I want it to move left to "9600", then I want it to move down to "120" then left to "360" then right to "9600".....
Something like that, you get the picture, once the Img1.left = that number, I want it to change directions and go to another number....... AND I DO NOT WANT TO USE 50000 TIMERS...
I HAVE NO CLUE HOW TO DO THIS...........
THANKS SO MUCH
(P.S. PLEASE HELP!!!!!!)
[]:::::::::::[];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;/
Did you know that you can be your own grandpa?! It's really cool. . . . . .
------------------------------------------------
But I'm not. . . Im just Myself. . . . .
Not my own grandpa. . . . . .
I put on my own pants today. . . . .
Im so proud of myself. . . . . 
-
Apr 14th, 2002, 03:11 AM
#2
Not NoteMe
Make a timer with an interval of 1000 or something (1 second)
Set it's property, Enabled to false so it doesn't start straight away
then put this code in it.
VB Code:
counter = counter + 1
Select Case counter
Case 1
img1.left = 9600
Case 2
img1.top = 120
Case 3
img1.left = 360
Case 4
img1.left = 9600
End Select
In the command button click event put
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 15th, 2002, 02:23 AM
#3
Hyperactive Member
The main thing is whether you want a gradual move or an instant move. If instant, then SLH's code is fine. If you want gradual movement it's a little bit trickier, but still easy.
-Show me on the doll where the music touched you.
-
Apr 15th, 2002, 04:16 AM
#4
Hyperactive Member
Sorry to interrupt your post, but i'm just checking to see if my counter works.
-Show me on the doll where the music touched you.
-
Apr 15th, 2002, 06:55 AM
#5
Lively Member
you could loop it
VB Code:
Do
Pic1.Left = Pic1.Left + 10
Loop Until Pic1.Left = 9600
Do
Pict1.Top = Pic1.Top - 10
Loop Until Pic1.Top = -120
and so on
-
Apr 15th, 2002, 09:20 AM
#6
Hyperactive Member
Actually, since he's moving the picture down, the code would be:
VB Code:
Pict1.Top = Pic1.Top + 10
Loop Until Pic1.Top = 120
-Show me on the doll where the music touched you.
-
Apr 15th, 2002, 11:10 AM
#7
Lively Member
Actually, while we are on this subject (and I can't be bothered to start a new thread), I need to know how to get the object (say a picture box) to follow your character, but gradually, not just to jump to it. For example, if you click on the point x,x with your mouse, I want the object to slowly move to that position. HOW!?
Ich widerstehe allem - nur nicht der Versuchung
(I can resist anything but temptation)
-
Apr 15th, 2002, 12:04 PM
#8
Lively Member
You could get the x,y positions of both the picturebox and the mouseclick. Once you have them, make a loop of adding 10 to the x, y position of the picture box until it reaches the mouseclick x y positions. Within the loop make the box move to the new position each time it loops.
There's probably much better ways to do this though API
-
Apr 15th, 2002, 12:42 PM
#9
Hyperactive Member
That would be the best way to do it. Instead of a loop, you could use a timer, though.
-Show me on the doll where the music touched you.
-
Apr 15th, 2002, 01:13 PM
#10
Not NoteMe
If you want to do nonlinear motion (i.e. Move faster if the charactor is far a way from the mouse) then instead of 10, you could use the distance/100 or something
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 15th, 2002, 01:36 PM
#11
Hyperactive Member
Or if you want an oddly moving object, use a random number and divide the distance by that.
-Show me on the doll where the music touched you.
-
Apr 15th, 2002, 01:45 PM
#12
Not NoteMe
Also, if you want the object to follow your charactor like in some RPGs (Final Fantesy...) then log every n (depending on how accuratly u want it to follow, and how fast your charactor moves) movenments your charactor, in an array, then move the following objecy to the last one in the array, then shift them all down 1 (inserting the current location of your charactor in the first element of the array).
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 15th, 2002, 02:45 PM
#13
Good Ol' Platypus
The way SLH suggests is the best way. However it won't work if it's something like a cloud layer that you want to follow.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Apr 15th, 2002, 03:03 PM
#14
Not NoteMe
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 15th, 2002, 05:04 PM
#15
Good Ol' Platypus
Something else that he might want to scroll with him, in this case my example was clouds. It would look very jerky.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Apr 16th, 2002, 04:03 AM
#16
Hyperactive Member
Yes, it would look jerky. If you want a decent RPG, C++ is normally the best way to go. I tried to amke one with VB but it didn't work very well.
-Show me on the doll where the music touched you.
-
Apr 16th, 2002, 11:22 AM
#17
Not NoteMe
Re: Making a Timer Move a picture Multiple Directions (EX:up then down then left then up)
Originally posted by spyplayer
Did you know that you can be your own grandpa?! It's really cool. . . . . .
Sounds like fun...
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|