Am I caught by Sprite.Value again?

Discussion in 'Questions (Windows Mobile)' started by enonod, Jul 11, 2009.

  1. enonod

    enonod Well-Known Member Licensed User

    I have in an add sprites sub...
    For j=0 To 19
       Pawn.New2(AppPath & 
    bit.ShiftLeft(Pawn.Data, j Mod 3)
       Pawn.X = 
       Pawn.Y = i*
       Pawn.Velocity = 
       Pawn.Direction = 
    Line 4 gives me an error... Object reference not set to an instance...
    Pawn object exists properly.
    My brain just isn't coping with something in this regard.
  2. agraham

    agraham Expert Licensed User

    Pawn.New2(AppPath & "\PSprite.png",6,15,15,6)
    You will save a lot more data using a "stock" Pawn and using New4 to share the Bitmap array than you will use up with all those "constants". That loop allocates a minimum of over 81Kbytes of bitmap pixel data not including class structure overheads.
    bit.ShiftLeft(Pawn.Data, j Mod 3)
    Why not "Pawn.Data=bit.ShiftLeft(1, j Mod 3)"?

    The code looks OK, have you "New1"ed bit?
  3. enonod

    enonod Well-Known Member Licensed User

    Well now, as I see it...
    1 you just added new4 to the Sprite Help while I was reading your answer
    2 I didn't study the Help carefully enough and probably would have missed it anyway
    3 same again, I didn't scroll the Help and didn't realise it was an Object.

    I have seem to have difficulty in forgetting the past. There is much subtlety to this B4PPC.
    Thank you for all and sorry to have wasted your time.
    [Edit] I would be grateful for a pointer to an example using New4 if possible
    Last edited: Jul 11, 2009
  4. agraham

    agraham Expert Licensed User

    This modified version of the Sprite example uses it. I'll ship this to Erel with the other stuff when I'm finally happy with the state of the library.

    Attached Files:

  5. enonod

    enonod Well-Known Member Licensed User

    I couldn't quite make the leap regarding from another sprite, which I now see can be a dummy.
    All is now clear, thank you for that example.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice