Ooops
March 05, 2021, 07:44:35 AM

Author Topic: [bb] Image wrapping by duncki [ 1+ years ago ]  (Read 417 times)

Offline BlitzBot

[bb] Image wrapping by duncki [ 1+ years ago ]
« on: June 29, 2017, 12:28:39 AM »
Title : Image wrapping
Author : duncki
Posted : 1+ years ago

Description : a little Image wrapping routine

Code :
Code: BlitzBasic
  1. ; a little wrap routine feel free to make it better
  2. ; modified by Andreas Duncker Germany
  3. ;sw = screenwidth
  4. ;sh = screenheight
  5. ;mx = the X Coordinates of the Image
  6. ;mw = the width of the  Image
  7. ;speed = the speed im Pixel for the Image
  8. ;this Wrap routine is from the Rocket Example but now a little bit smaller
  9. ;with only then Code that you must have.
  10. ;the only think that you must do is draw a little Image , name it "sprite.bmp"
  11. ;and put it in then same Directory where you put this code
  12. ;good luck!
  13. sw=640
  14. sh=480
  15. Graphics sw,sh,16,1
  16. sprite=LoadImage("Sprite.bmp")
  17. mw=ImageWidth(sprite)
  18. mx=640 ; in this Moment teh Startpositon of the image
  19. speed=-8;Speed in Pixel
  20. SetBuffer BackBuffer()
  21. While Not KeyDown(1)
  22. Cls
  23. mx=mx+speed;then current Movemen only in X
  24. If mx+mw>sw Then DrawImage sprite,mx-sw,100;now the wrap routine
  25. If mx>sw Then mx=speed
  26. If mx<0 Then DrawImage sprite,sw+mx,100
  27. If mx+mw<0 Then mx=sw-mw+speed
  28. DrawImage sprite,mx,100
  29. Flip
  30. Wend
  31. End


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal