Making a sprite move

tinmanjo

Member
Licensed User
How do i make a sprite move and not leave a trail behind of itself.

B4X:
Sub App_Start
   Form1.Show
   
   gw.New1("form1",0,0,form1.Width,form1.Height)
   
   spr1.New2(AppPath & "\block.jpg",1,30,30,1)
   spr1.X=100
   spr1.Y=100
   spr1.Velocity=0.1
   gw.SpriteAdd(spr1.Value)
   timer1.Enabled=True
   timer1.Interval=1000
   
   
End Sub


Sub Timer1_Tick
gw.Tick
spr1.X=spr1.X+5


End Sub

When the block moves it leaves an impression of itself, the block.jpg but i want it to delete the last move so that you get a transition.


Also in sprite.new2("xxxxxxx".... what image types are acceptable? bmp,jpg,gif etc..

An image is attatched to show you what I mean.
 

Attachments

  • blockproblem.jpg
    12.1 KB · Views: 192
Last edited:

sitajony

Active Member
Licensed User
Hi, you must to set a background image to your Form... If it's empty you'll see your "bloc" pasted as background... Did you try to set an image as background?
 

tinmanjo

Member
Licensed User
No i didnt set a background image but i will now, i didnt realise that this would cause a mirror effect.

Thanks for speedy reply.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…