Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Moving An Image To Move Another Image


Im creating my first small program for my assignment and ive done the design and code, just havign trouble with another part if anyone could help me please.

Here is my whole code first off.


Code:
Option Explicit

Private Sub cmdBat_Click()

While imgBall.Left < imgBatter.Left
'Moves the ball away from the bowler
imgBall.Left = imgBall.Left + 1
'Comment
DoEvents
Wend
'Comment
While imgBall.Left < imgBatter.Left
'Comment
imgBall.Top = imgBall.Top - 1
'Comment
imgBall.Left = imgBall.Left
' Allows the user to respond to another button
DoEvents
Wend
End Sub

Private Sub cmdBowl_Click()

While imgBall.Left < imgBowler.Left
' Moves the ball towards the batter
imgBall.Left = imgBall.Left - 1
' Allows the user to respond to another button
DoEvents
Wend
'Comment
While imgBall.Left < imgBowler.Left
'Comment
imgBall.Top = imgBall.Top + 1
'Comment
imgBall.Left = imgBall.Left
'Comment
DoEvents
Wend

End Sub

Private Sub cmdExit_Click()
End
End Sub

Private Sub cmdStart_Click()
imgBowler.Left = 8400
imgBowler.Top = 960
imgBatter.Left = 840
imgBatter.Top = 960
imgBall.Left = 7920
imgBall.Top = 2520
End Sub
What i need to do, as the ball gets to the bat for the bat to hit the ball and move it back where it came from. Ive done so far that the ball goes past the batter and when the bat button is pressed the ball comes back to the bat and goes back again.

I cant work out how to move the ball back when the ball is moving and the button is pressed. Im not advanced in programing either, ive been doing it for about a year

Here is an EXE of the program so far to demonstate
<link removed>




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Can't Get Image Admin, Image Edit, Image Scan To Work
Hi Guys,

Every time I go to add components and add the Kodak IMG components it tells me each one cannot be loaded.

I did have it working and then when I re-loaded my project it told me that 'ImgAdmin could not be loaded' and the same with ImgEdit.....'Do you wish to continue loading project anyway'.

Please can you help?...I am in real nead for them to work.

Much thanks,

Peter.

 

MOVE Image, Please Help!
Heloo everybody, can you explain me please how to move picture up, if
I press up arrow?


Thanks!

How Can I Move An Image With GDI+?
Hello guys:

How can i move an image with GDI+ fastest?
(I try simulate clouds)

Move An Image.
Hey guys I was just wondering how would I move an image6 to the top.

I understand the very top of the form is 0. and the code would be image6.move, but how do I tell it to move to the top (0)?

Thanks!

Move An Image
if i had just a form and an image on that form, could anybody tell me how to move that image about by keeping the left mouse button down anywhere on the image and be able to move it around until i let the mouse button back up.

thanks.

Vb.net Image Move?
hi i would like a image in my vb.net programe to move on thescreen when a user clicks a button, how would i do this?

Regards

Homer

Move Image
i have got a picture box with an images within it.
i would like to be able to move each image in a drag drop style.
they need to be idependant.

any help would be great
thankyou in advance

Image Moving
vb6.0
Hi,

id like to know how to move a picture inside an picture box without moving the box but only the picture inside it. like, i have a 2000x2000 picture in a 400x400 picture box and wat i want is for it to show inside it and then i move the picture to see differ parts of it while the picture box remains in the same place.


Thank you.

Seeing The Image While Moving It
How to move an Image (or a PictureBox) over a Form and see the image, not only its surrounding frame, during the move phase. Basically, my code looks as follows:

[vbtemp]
Private Xi As Single
Private Yi As Single

Private Sub Card_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Card(Index).Drag vbBeginDrag
Xi = X
Yi = Y
End If
End Sub

Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X - Xi, Y - Yi
End Sub

Private Sub Card_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
Source.Move Source.Left + X - Xi, Source.Top + Y - Yi
End Sub
[/vbtemp]

The 'Card' is an Image (or a PictureBox) located in a control array. The code works fine, but I can't see the card face while I'm moving it.

Moving An Image
I tried borrowing the code from ?????'s pacman example

Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'figure out where we WANT to go....
Select Case KeyCode
Case vbKeyLeft:
ShpTestShooter.Move -350
Case vbKeyRight:
ShpTestShooter.Move 350
End Select
End Sub


Private Sub Form_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case vbKeyLeft:
ShpTestShooter.Move -350
Case vbKeyRight:
ShpTestShooter.Move 350
End Select
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyLeft:
ShpTestShooter.Left = ShpTestShooter.Left - 350
Case vbKeyRight:
ShpTestShooter.Left = ShpTestShooter.Left + 350
End Select
End Sub

arrrrggggh!!
how did he managed to get his pacman working???
My program refused to respond to my pressed keys
which are arrow buttonws
Put a breakline, it absolutely refused to go there

Image Moving
How can you get a picture box or an image to move across the screen. I'm guessing you can use a timer, but am not quite sure how to set up the timer. What I have is... a for next loop in a sub called PlaneMove (I call that sub in GameLoop). So, in this sub, I set the image.visible = true, and then the for next loop is
For i = 1 to MAXPLANEX (MAXPLANEX is the end of the form to the right)
Picture.move i, Y (Y is an int(Rnd) formula to make the y coordinate a random number)
Image.move i, 0 (I don't know why, but I can't get the picture box to move across the screen without an image moving across the screen also, but if I just have an image it jitters, and has problems.)
Next i

So anyway, the result of the for next loop is that it works, the Picture Box of an image of a plane moves across the screen very smoothly, but there is one problem. The whole loop has to go through before any other action can be done, and in this case in this game, Player 1 is a tank that has to shoot the plane, and it should be able to move left and right, and up and down, with the max y coordinate set at an integer so that it can't pass that integer. The problem is, the plane has to move through the entire screen, and only after it passes, will the tank move to the cursor position, and Player 1 can't shoot at all, because as soon as the plane goes through the loop and gets to the end of the screen, and once the new tank picture is drawn at the tank coordinates, the planeloop starts again, and therefore there is no time for the ball to shoot out and move. I'm guessing that with a timer, the plane can move through the screen, and Player 1 can do all of the other actions without any problem, but I just can't figure out an algorythm for the timer, so I'm just basically stuck in an everlasting loop... both in the game and in the code... any suggestions?

Moving A Image
here is my code:

Private Sub Timer1_Timer()
imgshield.Move Left - 100, Top + 1000
End Sub

i've placed my code in the timer and form coding areas but it still won't work... why won't it... I want it to move constantly I.E.: like this simple little "."

I want it to go like this:
. . . . . . . .

I want it to be constantly moving until I tell it to stop

P.S. my interval's set at 1000

Moving Image
anyone have a code snipplet for that I could place in a timer to make an image move (right to left) accross my form? thanks in advance!

Moving Image (gif)
How can I add a moving gif on my form?
when I do it with a picture box or image it wont won't move.
can anyone tell me how I can do this?


//golles

Moving An Image
Is there a way where I can drag an image anywhere i want on a forum and when i let go the image will stay there?

Moving Image
I want to devolop

a project in which i want to gif images they are moving means animated
but when i put them on label or imge control
they become constant means not moving how can i use the please give some
sugestion
Thanks

Moving A Image
How can i move an image left and right???I would imagine its simple but i suck at vb well i will apreciate the help ty!

Moving An Image
how do i make an image move?

Image Moving
I have an image control on a form, and I'm trying to get it to move.

I want the user to be able to either click/drag it to anywhere on the form, but can't get the right event/code combination. Anybody know how to move an image during run-time?

Thanx.

Moving An Image
hello all,

i m trying to drag an image from a specific place on the form,
and drop it on another .

how can i do that?

tnx
LirLir

Moving An Image Everywhere
can someone please help me i need to know how to move an image in all directions randomly such as right left up diagonally ect (RANDOMLY) please

Moving Image So It Goes Everywhere
i need it so when i press go ..
the image will move randomly everywhere

such as a bird.. so when i press go the bird will fly down up left right diagonally and it will do it randomly

PLEASE HELP ME

Moving Image Help
Hi everybody!
can anyone tell me agood way of making an image float randomly around the screen? i've tried 'do until ' and 'if then' without getting the results I want.
Thanks in advance for any suggestions.

Moving An Image
Thanks to the guy who helped me move the image around the screen by using the keys but i have another problem. How do i make it so that when the user presses the keyboards left arrow, the image moves left but changes to another image. e.g.

i want to move the elephant image left
when i press left i want to move the image but change the image to one that is of an elephant facing left

how do i do this with al the arrow keys?

Move Image Without Flickering
I've been trying to make a simple interactive game for a school project. I'm done a few of these, but I'm getting tired of the images flickering when I use the .move function. Is there any way to get these images to transition and move without flicking? Thanks for your help!

Move Image Left
I have an image in a picturebox and I want to move it right or left.
I'm currently thinking at 2 methods:

1) redraw the image again at the new coordinates
2) save in an array somewhere a number of pixels and append them to the end of the picturebox and then move all the bits left with that number of pixels.

Is there any known algorithm for doing this or should I implement one of my own?

Move Image From One Picturebox To The Next
I am creating a simple board game in Visual Basic that requires the gamepieces (PNG images) to advance the right number of spaces, which are actually pictureboxes. The image has to leave one picturebox and appear in the next. The number of spaces (pictureboxes) to advance to are located in a textbox.

I would prefer a response by April 19 or 20, as I need to finish the game by then.

Image Doesn't Move...
I am making this program, where on one form you use the arrow keys to move an image around the form. The problem is it doesn't seem to work.

Code:
Private Sub Form1_KeyDown(KeyCode As Integer, Shift as Integer)

Select Case KeyCode
Case vbKeyUp
'action - Moves image
Case vbKeyRight
'action - Moves image
Case vbKeyLeft
'action - Moves image
Case vbKeyDown
'action - Moves image
End Select

End Sub
What is the problem here? I have tried everything to fix it. I even changed all that Select Case to If-Then but still nothing. I changed to image to a label, command button, shape and a checkbox, but nothing still. I have tried putting breakpoints and this is how they came out...

Code:
Private Sub Form1_KeyDown(KeyCode As Integer, Shift as Integer)

Select Case KeyCode
Case vbKeyUp 'Oddly this breaks on any keypress that is NOT that arrow, hmm.
'This line does not break on any keypress
Case vbKeyRight
'This line does not break on any keypress
Case vbKeyLeft
'This line does not break on any keypress
Case vbKeyDown
'This line does not break on any keypress
End Select

End Sub

I am sooooo confused , I thought it might be a setting with the form or something, because nothing works..

Anyone know what is wrong here??

Cheers,
Tim

I Want An Image To Move With The Mouse
I have an image,
I want it to move where i move the mouse to
if I move the mouse right, then the image will move right,
if I move the mouse to the left then the image will move to the left...
please help me...

Image Move Loop
I'm creating a pong program for my VB class. I have everything down...I just want to change the paddle movements.

I wanted to make it so when you hold down the up or down arrow key it moves the paddle 50 twips or so while holding it down.

Similar to when you hold down a key on the keyboard and it starts repeating itself. At that speed, without the delay.

I hope I made myself clear.



Thanks,
~Nate

- Move An Image Using Timer
Dear Experts,

Can somebody please guide me how to move an image in a form using timer control.

Many Thanks
Eshu

How Do You Make An Image Move?
I want to make a ball or something i draw to move across the form. How would I do this?

Image Move Problem
Hi all,



i'm need to move a picture in the screen, but the image move resolution is bad, like as slow motion.

Please, how to improve a fast picture move?

I Want To Move An Icon OVER An Image.
I can make the icon move but for some reason it keeps going BEHIND the image.
N E Help...

How Would I Make This Image Move
Iam creating an adventure game and I have a screen where once the player enters I want an image to move from the far left of the screen and stop in the middle of the screen can you please give me all the steps I need to know to do this please?

Image Move Speed
I have an application to move an image with a mouse click. I use the mouse over with mouse click to enagle image move. this is a custom slider. I find that when mouse is moved fast the image does not keep up and I love the mouse over envent. I dont have any other code running and no timers enabled. Can I speed up image move or can anyone see an error in my code that would case this ? Note ther are 3 images images(0), images(1), images(2)

Code:


Private Sub Image1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x1 As Single, y1 As Single)

If moveimage(Index) = True Then


        Select Case Index
        
        Case 0
        If x1 > 0 Or x1 < 600 Then
        movebar = True
        Else
        movebar = False
        End If
        
        Case 1
        If x1 > 0 Or x1 < 600 Then
        movebar = True
        Else
        movebar = False
        End If
        
        Case 2
        If x1 > 0 Or x1 < 600 Then
        movebar = True
        Else
        movebar = False
        End If
        
        End Select
        
       
        
        If movebar = True Then
            intpos(Index) = y1 - (Image1(Index).Height / 2) + MoveY(Index)
            
            If (intpos(Index) < 1540) And (intpos(Index) + 10 > 0) Then
            

            ScrollValue(Index) = 255 - (intpos(Index) / 6)
            Image1(Index).Top = intpos(Index)
            MoveY(Index) = intpos(Index)
            
            Select Case Index
            
            Case 0
            intFixtureR(intButtonSelect) = ScrollValue(0)

            Case 1
            intFixtureG(intButtonSelect) = ScrollValue(1)
            
            Case 2
            intFixtureB(intButtonSelect) = ScrollValue(2)
            
            End Select
           endif
   End If
End If
End Sub





Private Sub Image1_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
moveimage(Index) = False

End Sub

Private Sub Image1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
moveimage(Index) = True
End Sub






 

VB.6 User, Since 2002
Next Generation Lighting Controls
www.jmelectronics-online.com

Moving Image W/ Mouse
I wanted to have an image move according to the mouse cursor. I've managed to do that with a mousemove procedure on the form. However, the image moves fine on the right side of the screen, but the image doesn't move so smooth on the left side. I'm not sure why there would be a difference, and I cannot change the effect.

Moving Image- Flashes
Hi,

I've got a very simple program, where a image in VB moves around the screen. To get it to move smoothly, i've put a timer on at 1ms, and it moves 1 pixel every ms. It works great.
However, the image "flashes" as it moves- black lines appear down it- like watching a TV screen through a camera. I've tried changing it to 10ms, 10 pixels, etc, but that doesn't really help much, since it is jerky.

Moving Image Too Fast...
Im working on a game that sets a image's position every 500
milaseconds, it works fine just looks well.... dumb... it shows the image move over then down kinda like streaking it to its position, I think bitblit will fix this but id rather not get into all that if there is an easyer way and yes it is very inportent that it sets the position every 500 milaseconds

Image Loading/moving
I was wondering if there is a way to load or move an image from a different form.

For example, if I have a picture in Form2.frm and I want to be able to display that image in Form1.frm at different times during the program, what would I do? I want to do this so that I can just store all my pictures in a form separate from my game and just call the images whenever needed.

Any help is appreciated.
Thanks.

Moving An Image With The Mouse
hey all, just wondering if anyone could point me in the direction of moving an image by clicking on it, and while holding the mouse button down and moving it in any direction, how to change the properties of the image(in this case, the .left, or .top properties)
Thanks in advance.

Image Moving On Keypress
2 questions.. # 1, is there a KeyAscii for the arrow up down right left keys??


and #2, when i make Image1.left = image1.left - 25 , it moves but it flashes. Thats very annoying and ugly, ive tried transparent and not transparent, it always flashes. is there a way so it moves without flashing???

Making A Moving Image Go The Other Way?
Hey, Ive got an image moving around on my screen using option buttons, (up down left right) and I want, when it gets to a certain point, to go the other way. So say up is selected and it gets to y 3180 I want it to start going down. Ive had a go at the coding on the 5th line but it doesnt work, the other 4 do though. Can anyone help please? thanks

Private Sub Timer_Timer()

Dim original As Single


If OptDown.Value = True Then
ImgCross.Top = ImgCross.Top + 50
End If

If OptUp.Value = True Then
ImgCross.Top = ImgCross.Top - 50
End If

If OptLeft.Value = True Then
ImgCross.Left = ImgCross.Left - 50
End If

If OptRight.Value = True Then
ImgCross.Left = ImgCross.Left + 50
End If



If ImgCross.Top = 3180 Then
OptUp.Value = False
ImgCross.Top = ImgCross.Top - 50
End If

End Sub

Label In A Moving Image
is there any way to put a label or text inside a moving image so it contains some text in the center even when moving? This text will randomly changes everytime a certain event triggers

or I have to use the frame thing??

Moving An Image Up On Click
Im making a helicopter type game, and i want the helicopter to rise when i click the left button on the mouse. Also, i would like the helicopter to fall when the left button on the mouse isnt being clicked. My image name is helionclick. Im using vb 6.

Moving Image On Vb Form
hi all,

i want to add a image on vb form but not a static image .image like..
example: when we copy a folder and then paste somewhere moving
image of copying process.
anybody can help me.

thanks ,
abhishek mishra

Moving The The Form With Image??
i dont undersatnd realy how to do it

i took off the border (purpusly) i cant spell


Code:
Private Sub imgtop_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
frmmain.Top = Y
frmmain.Left = X
End If
End Sub


this is what i did, it moves but its so glitchy its jumps all over

plz help

Getting A Moving Image To Reverse Itself
Hey, you guys were really helpful last time, but alas I'm stuck again. I've got an image (ImgCross) moving around a screen with check boxes, but I want it, when it gets to a certain coordinate to go the other way. Any ideas? Thanks

The first four lines work fine but the bottom line doesn't do anything

If OptDown.Value = True Then
ImgCross.Top = ImgCross.Top + 50
End If

If OptUp.Value = True Then
ImgCross.Top = ImgCross.Top - 50
End If

If OptLeft.Value = True Then
ImgCross.Left = ImgCross.Left - 50
End If

If OptRight.Value = True Then
ImgCross.Left = ImgCross.Left + 50
End If



If ImgCross.Top = 1800 Then
OptUp.Value = False
ImgCross.Top = ImgCross.Top - 50
End If

Moving And Image W/ The Mouse.
Hi, I am working on a simple board game. When the player moves a piece, an image box appears (that moves with the mouse), the picturebox containting the board is redrawn wihout that piece, and it is moved to the new spot and the "dummy" piece dissapears and the board is redraw again with the new move. My only problem is: the pieces are round, and the image box that moves is square. When you move the piece, you can see the square border. What can I do about this?

Copyright © 2005-08 www.BigResource.com, All rights reserved