WeavMan
03-11-2002, 04:56 PM
Ok i finally got it to work, only one problem I can not get the paint ball to shoot from the guy, it shoots from where i placed the origional picture of the paint ball. How do I make it so that the paint ball appears to be comming out of the guy. also how can i get it to run forwards and backwards. "I had it working now it wont
Private Sub Form_KeyPress(KeyAscii As Integer)
moveme = Chr(KeyAscii)
If moveme = Chr$(97) Then Image1.Left = Image1.Left - 300
If moveme = Chr$(115) Then Image1.Left = Image1.Left + 300
If moveme = Chr$(32) Then Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Shape1.Visible = True
For i = 7800 To 240 Step -1
Shape1.Top = i
Next i
Shape1.Visible = True
Timer1.Enabled = False
End Sub
--Thanks--:D
Aviator
03-11-2002, 05:00 PM
One quickie question: the paintball is Shape1 correct?
Also, why do you have two Shape1.Visible = True statements a few lines of code away from each other? I would like to suggest that you also change the form's scalemode from twip to pixel (pixels are a lot easier and faster to work with).
WeavMan
03-11-2002, 05:06 PM
I just saw that I didn't mean to. It works just fine with out it
WeavMan
03-11-2002, 05:23 PM
How would i go about changing it to pixels?
Squirm
03-11-2002, 05:36 PM
Maybe this?
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 97 Then Image1.Left = Image1.Left - 300
If KeyAscii = 115 Then Image1.Left = Image1.Left + 300
If KeyAscii = 32 Then
Shape1.Move Image1.Left, Image1.Top
Timer1.Enabled = True
End If
End Sub
WeavMan
03-11-2002, 06:52 PM
Thanks squirm but thats not working, when i hit the space bar to make it fire the dot goes to the ship but whaen the timer plays the ball starts at the bottom of my form. Do you have any other ideas?
Aviator
03-11-2002, 07:15 PM
Squirm's code should work to make the ball be equal to where Image1 is. If you want the ball centered in the middle of Image1, try something like (untested):
Shape1.Move Image1.Left + (Image1.Width / 2) - (Shape1.Width / 2), Image1.Top - Shape1.Height
It should work to center the ball wherever Image1 is... Good luck.
Squirm
03-12-2002, 01:25 AM
To change to pixels, set the form's .ScaleMode property. :)
Iceplug
03-12-2002, 06:54 AM
In the Timer event, you have
Shape1.Top = i
and I goes from 7800 to 240, so it will start out at 7800 from the top. Might I suggest a variable to hold the distance that the object is from the Top.
TopDist = Image1.Top
For i = TopDist to 240 Step -1
'etc.:cool:
Assuming that the ship is below 240 from the top.