Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Display Sprite on New Char (Different Way)
#1
Well, I was looking at the tutorial we had here on displaying the sprite on New Character and I came up with a different solution. Here goes.

Difficulty: 1 / 5 (Simple)

::Client Side::
Go into your frmNewChar and add a timer, and two picture boxes
  • Set the timer to be enabled and have a 50 interval.
    The first picture box is your actual display. Size to 32x32 (assuming you have 32x32 sprites).
    The second picture box should be placed where it won't be seen. Size to 32x32. Auto-size to true. Auto-redraw to true.

Add the following code under form_load
Code:
offscreenpicturebox'snamehere.picture = LoadPicture(App.Path & GFX_PATH & "sprites" & GFX_EXT)

Add the following under the timer_tick
Code:
Call BitBlt(actualdisplaypicturebox'snamehere.hDC, 0, 0, 32, 32, offscreenpicturebox'snamehere, DIR_DOWN * PIC_X, cmbClass.ListIndex * PIC_Y, SRCCOPY)

That is all. Now, when you change the cmbClass to something else, it will blt that sprite. Replace names with what you named your stuff.

[NOTE]this only works if you have your classes where class 0 is sprite 0, class 1 is sprite 1, etc.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)