moving a sprite?

Discussion in 'Questions (Windows Mobile)' started by colin9876, Nov 25, 2007.

  1. colin9876

    colin9876 Active Member Licensed User

    My Lunar Lander project.

    1) Where can I find a bitmap editor to map my 16x16 lunar lander spacecraft?

    2) Then how do I do print at (x,y) my lunar_lander.bmp

    I have already done lunar lander with a spaceship drawn out of lines and circles - wow what a game lol! but I think it may be better with a bitymap if I can move that a pixel at a time?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    2) You can use an Image control and change its Left and Top properties, or you can draw the bitmap on the form's fore layer (Form1.FDrawImage) and erase the old bitmap with Form1.FErase each time.
     
  3. colin9876

    colin9876 Active Member Licensed User

    Using the image control to move the spaceship worked good. Not having to erase it before a move is great.
    2 more questions

    1) If my spaceship is on a white background, is there a way to make this white transparent so I can see the backdrop through it?

    2) Whats the best way to scroll a screen as in a 'scrambler'/'defender' type arcade game?
     
  4. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Q1) If you want to set your background as white then I recommend using a different colour background for the spaceship (say magenta) and then this will be the transparent colour.

    Q2) I don't think it is the screen that scrolls, I'm pretty sure it is just an image in the background that is larger than the form and as this is moved from right to left it gives the perseption that the ship is fying.

    Regards,
    Randomcoder
     
  5. colin9876

    colin9876 Active Member Licensed User

    Thanks - maybe I didnt explain about the white properly

    My picture of a spaceship 16x16 bitmap is on a white background

    The backdrop on the screen is the lunar landscape and night sky - all different coulours.

    How do I make the white in the image transparent, so the backdrop shows thro where the spaceship sprite has white space in it? Can u give me the command to use? do I set this in the code, or in the properties of the image box?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    You could use an ImageButton and set its Enabled property to false.
    ImageButtons (unlike Image controls) support transparency.
    You could also draw the image on the fore layer instead of using a control.
     
  7. colin9876

    colin9876 Active Member Licensed User

    After Ive landed the lunar lander, I called App_start to have another go at the game.
    this does not reset the variables (i.e. re run global) or clear the screen

    Is there a better way to rerun the program right from the start, like a Run command.

    p.s. is there a clear screen command like CLS on my ZX81 ?
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    You should reset the variables manually.
    Clearing the screen can be done by calling Form1.Color = Form1.Color, or by loading the background image again.
     
Loading...