96 by 96 npc sprites (currently not working)

THIS REMAINS UNTESTED: I had to rush the code as I’ve got to go soon I will test it when I get back. Most of this is just from memory.

DONT DO THIS TUTORIAL YET IT WILL NOT WORK (because I’m an idioit who rushes things)

ALL CLIENT SIDE

step 1 go to frmnpc editor add in a new option button call it BigNpc96.
Add the following code
 ```
If BigNpc96.Value = Checked Then
        picSprite.Width = 960 'not sure on dimentions
        picSprite.Height = 960 'not sure on dimentions
        picSprite.Top = 1900 'not sure on dimentions
        picSprite.Left = 3360 'not sure on dimentions

picSprites.Picture = LoadPicture(App.Path & “\GFX\96Sprites.bmp”)
end if

Step 2 coding
go to modDirectx

find

Public DD_SpriteSurf As DirectDrawSurface7
Public DDSD_Sprite As DDSURFACEDESC2

Add

Public DD_96SpriteSurf As DirectDrawSurface7
Public DDSD_96Sprite As DDSURFACEDESC2

find

’ Init sprite ddsd type and load the bitmap
    DDSD_Sprite.lFlags = DDSD_CAPS
    DDSD_Sprite.ddsCaps.lCaps = DDSCAPS_SYSTEMMEMORY
    Set DD_SpriteSurf = DD.CreateSurfaceFromFile(App.Path & “\GFX\Sprites.bmp”, DDSD_Sprite)
    SetMaskColorFromPixel DD_SpriteSurf, 0, 0

Add

’ Init sprite ddsd type and load the bitmap
    DDSD_96Sprite.lFlags = DDSD_CAPS
    DDSD_96Sprite.ddsCaps.lCaps = DDSCAPS_SYSTEMMEMORY
    Set DD_96SpriteSurf = DD.CreateSurfaceFromFile(App.Path & “\GFX\96Sprites.bmp”, 96DDSD_Sprite)
    SetMaskColorFromPixel DD_96SpriteSurf, 0, 0

find
Sub DestroyDirectX()

Add

Set DD_96SpriteSurf = Nothing

Go to bltnpcBody
and add in

If Npc(MapNpc(MapNpcNum).num).Big = 2 Then
            rec.Top = Npc(MapNpc(MapNpcNum).num).Sprite * 96 + 32
            rec.Bottom = rec.Top + PIC_Y
            rec.Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X
            rec.Right = rec.Left + PIC_X

X = MapNpc(MapNpcNum).X * PIC_X + sx + MapNpc(MapNpcNum).xOffset
            y = MapNpc(MapNpcNum).y * PIC_Y + sx + MapNpc(MapNpcNum).yOffset

’ Check if its out of bounds because of the offset

If y < 0 Then
                rec.Top = rec.Top + (y * -1)
                y = 0
            End If

’ Call DD_BackBuffer.Blt(rec_pos, DD_96SpriteSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
            Call DD_BackBuffer.BltFast(X - (NewPlayerX * PIC_X) - NewXOffset, y - (NewPlayerY * PIC_Y) - NewYOffset, DD_96SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If

Go to BltNpcTop
add in

If Npc(MapNpc(MapNpcNum).num).Big = 2 Then
        rec.Top = Npc(MapNpc(MapNpcNum).num).Sprite * 96
        rec.Bottom = rec.Top + PIC_Y
        rec.Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X
        rec.Right = rec.Left + PIC_X

X = MapNpc(MapNpcNum).X * PIC_X + sx + MapNpc(MapNpcNum).xOffset
        y = MapNpc(MapNpcNum).y * PIC_Y + sx + MapNpc(MapNpcNum).yOffset - 64

’ Check if its out of bounds because of the offset
        If y < 0 Then
            rec.Top = rec.Top + (y * -1)
            y = 0
        End If

’ Call DD_BackBuffer.Blt(rec_pos, DD_96SpriteSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
        Call DD_BackBuffer.BltFast(X - (NewPlayerX * PIC_X) - NewXOffset, y - (NewPlayerY * PIC_Y) - NewYOffset, DD_96SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)

EDIT
Bah dont do this tutorial yet it won't work I'll finish it off when I get home

Actually this might work, but you would have to make your own sprites. You can’t use premade, I don’t think there are many.

Why do people post stuff thats not even tested? baffles me.

Lol, right. Still they could get comments from other members, and maybe get a fix.

Well he did say at the bottom that i didnt see:
“Bah dont do this tutorial yet it won’t work I’ll finish it off when I get home”

However, I sort of still dont understand posting something unless you have got it working. Perhaps posting it, and say “I cant get this working”  :huh:

The reason is I was in a rush and was doing this tutorial off the top of my head and just looking at the soruce to rip stuff out. When I posted it I thought it would work then forgot I missed some key stuff out  :P. I forgot about this topic will fix the code up now.

Wow thats such a backwards way to do a tutorial, good luck.

Better then a topic for a tutorial with as content coming soon.
Hope you get it working

That sig is way too big Zidsal.

Well
This code is already present in Baron’s EE2.0(or 2.4 - I dont remember)

I got it working by adding just one line of code.
(Ofcourse, if you’re using EE2.7 + you might need to add the 96x96 code aswell.)
But why not just wait for EE3.0?

@{WTF}:

I got it working by adding one line of code.

Could you pretty please tell us what that line of code is and where it goes?

how would u do a sprite sheet for this?? Looks great and i wanna use it and btw u can premade stuff by using a program that allows you to strech images but it will probaly look bad so yea…

i found error

change this:
   ```
Set DD_96SpriteSurf = DD.CreateSurfaceFromFile(App.Path & “\GFX\96Sprites.bmp”, 96DDSD_Sprite)

with:

Set DD_96SpriteSurf = DD.CreateSurfaceFromFile(App.Path & “\GFX\96Sprites.bmp”, DDSD_96Sprite)

Is this working it would be a nice addition to my game

Log in to reply