Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Bigger Sprites


Corbo
 Share

Recommended Posts

Failing to do bigger sprites I am now trying to make players display (normally 32 x 64) but without blocking other players.

Players should still be able to be blocked by in game elements but not players or npcs.

~~I was trying to make bigger player sprites (at least 64 x64) before starting to actually make the game but no matter what I do it doesn't work.

I have read every single topic on this and haven't really found an answer  (Note: I do know that you can change NPCs to big sprites).

The problem I found is that, let's split a sprite like this:

| 1 | 2 |
| 3 | 4 |

If the sprite is split in 4 parts quadrant 2 doesn't show up. Actually it does show up but on quadrant 1, quadrant 2 is just empty.
And while attempting to make 96x96 was even worse:
![](http://img10.imageshack.us/img10/6008/testse.png)

Nothing in the top row after quadrant 1 is printed out, yay.

I'd like to know if anyone can help me out with this, and if possible make the bigsprite changing class specific (some classes are big some are normal 32 x 64) I don't mind if big sprites don't block the path of other characters.

Thanks for all the help.~~
Link to comment
Share on other sites

If you mean change
```
            rec.Left = (GetPlayerDir(Index) * 3 + Anim) * 32
            rec.Right = rec.Left + 32
```
So the 32s are 64s, that's one of the first things I did.

Then I stopped with another topic that said:

```
            rec.Left = (GetPlayerDir(Index) * 3 + Anim) * 64
            rec.Right = rec.Left + 64
            rec.Top = Item(Player(MyIndex).Shield).Pic * 64 + PIC_Y
            rec.Bottom = rec.Top + 64
            Call DD_BackBuffer.BltFast(X, y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
```
and I did that and when it failed I also changed every rec.Bottom to be +64 and when THAT failed I literally just copied the entire 96 x 96 code and pasted over the 32 x 64 one.

If it's not that then I don't understand what you're telling me.
Link to comment
Share on other sites

Nope, still getting the same result of a part not showing up and the other one showing on another place.

EDIT:

Best I've got so far:
![](http://img32.imageshack.us/img32/7449/big2.png)

By doing this:
```
            rec.Left = (GetPlayerDir(Index) * 3 + Anim) * 64
            rec.Right = rec.Left + (PIC_Y * 2)
```
Sound * 3 or * 27 just inverts everything.

EDIT 2: I did something wild and multiplied everything by 2 (hoping to get 64 x 128). I got like tons of sprites on the right but none of them in the top row. I'm beggining to think that nothing can be printed in the quadrant 2.
Link to comment
Share on other sites

Hai again, didn't want to create a new topic so I used the same old topic.

Failing to do bigger sprites I am now trying to make players display (normally 32 x 64) but without blocking other players.

Players should still be able to be blocked by in game elements but not players or npcs.
Link to comment
Share on other sites

Triple post, yay!

I managed to do both, players not colliding with players or NPCs and biggers sprites. Right now 64 x 64 but I could easily do way bigger, I think I'll actually make them bigger.
I also changed the placement of HP bars and player name to make things pretty
![](http://img38.imageshack.us/img38/1465/64x64.png)

Thanks to the people that tried to help.
Link to comment
Share on other sites

BIGGER PLAYER SPRITES

K, so what I did is, first, removed the need for bltplayertop (Found this tutorial while lurking the boards)
Search for
```
                    ' Blit out players top
                    If SpriteSize >= 1 Then
                        For i = 1 To MAX_PLAYERS
                            If IsPlaying(i) Then
                                If GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                                    Call BltPlayerTop(i)
                                End If
                            End If
                        Next i
                    End If

```

And change it to:
```
                    ' Blit out players top
                    If SpriteSize >= 1 Then
                        For i = 1 To MAX_PLAYERS
                            If IsPlaying(i) Then
                                If GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                                    If GetPlayerY(i) = y Then
                                        Call BltPlayerTop(i)
                                    End If
                                End If
                            End If
                        Next i
                    End If

```

Now, to really change the size of your sprite find "32 X 64"

That should bring you to where the sprite is rendered and all that jazz.
It should look like:
```
    ' 32 X 64
    If SpriteSize = 1 Then

        ' 32 X 64
        If paperdoll = 1 And GetPlayerPaperdoll(Index) = 1 Then

            rec.Left = (GetPlayerDir(Index) * 3 + Anim) * 32
            rec.Right = rec.Left + 32

            If Index = MyIndex Then
                X = NewX + sx
                y = NewY + sx

                ' PLAYER 32 X 64 IF DIR = UP
                If GetPlayerDir(MyIndex) = DIR_UP Then

                    ' PLAYER 32 X 64 BLIT SHIELD IF DIR = UP
                    If Player(MyIndex).Shield > 0 Then
                        rec.Top = Item(Player(MyIndex).Shield).Pic * 64 + PIC_Y
                        rec.Bottom = rec.Top + PIC_Y
                        Call DD_BackBuffer.BltFast(X, y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
                    End If

blah blah blah blah
```That's just a piece of the code, it's far too long to post. Anyway,

Change the currents rec.Left and rec.Right to this:
```
            rec.Left = (GetPlayerDir(Index) * 3 + Anim) * 64
            rec.Right = rec.Left + 64
```

And Change the currents rec.Top and rec.Bottom to
```
                    rec.Top = Player(Index).head * 64 + PIC_Y - 32
                    rec.Bottom = rec.Top + 64
```
I think, but only think (I haven't tested it) If you wanted bigger sprites you could just double the values. If you wanted 128x128 sprites, for example, you'd have to change the modified 64s to 128s and the 32s to 64s. (Just a guess)
Change them in both, Paperdoll and not paperdolled. Note that in my tests I only did not paperdolled ones because I'm not really going to use paperdolls. If you are, then change it in both.
For less experienced users, with paperdoll and non paperdoll I mean parts of the codes
The paper dolled part starts in:        If paperdoll = 1 And GetPlayerPaperdoll(Index) = 1 Then
And ends in (after scrolling down a bit):            ' END OF PAPERDOLL FOR 32 X 64

And the non paper dolled part starts in:        ' IF 32 X 64 AND NO PAPERDOLL
And ends in:        ' END OF 32 X 64

Now, here's a small screenshot to explain what the output will be like:
![](http://img36.imageshack.us/img36/1772/uscrn.png)
In blue, the normal 32 x 64 sprite. In yellow, the new 64 x 64 sprite.

CHANGING THE POSITION OF THE HP BAR

Now, just like any good thing this also comes with a price. The name and the HP bar are way up there. In my first edit they were even higher, with this new edit I just did it's actually rather "decent".
But you don't have to worry about that, the HP bar position can be moved and the name can also!

To change the position of the HP bar find this:
```
    If SpriteSize = 1 Then
        ' draws the back bars
        Call DD_BackBuffer.SetFillColor(RGB(255, 0, 0))
        Call DD_BackBuffer.DrawBox(X, y - 30, X + 32, y - 34)

        ' draws HP
        Call DD_BackBuffer.SetFillColor(RGB(0, 255, 0))
        Call DD_BackBuffer.DrawBox(X, y - 30, X + ((Player(Index).HP / 100) / (Player(Index).MaxHp / 100) * 32), y - 34)
    Else

```

For people that don't know what this "monster" is (aka people that now nothing about coding) here's what it is:
The HP is actually _two_ bars. The background is completely red and then green bar that indicated the ammount of HP you have is on top of that other background red bar. So when you are hit a little piece of that green bar is taken away and showing off the red background.

The part after 'draws the back bars, draws indeed, the red bar. You can change the color of the red bar if you want by modifying the value after RGB(), just grab a program like Photoshop select a color and find the r,g,b value and use it there. (All of this is in the SetFillColor)
Moving on to the other line we have the Drawbox, that is the line that actually draws the box. This function requires 4 values to draw the box, the four corner values.

It'd kinda be like this DrawBox(x1,y1,x2,y2). Where x1 is the start of the box horizontally and x2 is the end of the bar horizontally and where y1 is the start vertically and y2 the end.
Take this line for example:        Call DD_BackBuffer.DrawBox(X, y - 30, X + 32, y - 34)
The box starts at x and at y - 30\. Meaning that the upper left corner is at (0,-30)
And it ends at x + 32 and at y - 34\. Means that the bar is 32 pixels wide and 4 pixels high (y2-y1 = -34-30).

For reference use this image:
![](http://img36.imageshack.us/img36/1772/uscrn.png)

The (0,0) would be (if I am not mistaken) the upper left corner where the sprite starts. If you wanted for example the HP bar to be _below_ the character You'd have to add to the heightso it is y + 64 (or maybe a bit more). Got it?

Then there's the 'draws HP.
Same as SetFillcolor applies here, if you want to change it, you can.
The same rules of DrawBox also apply here, just that this time there's more code in it since the green bar is "dynamic" since it changes. If you notice it still follows the format of Drawbox(x1,y1,x2,y2) and the only value that changes is the x2 that includes a code to draw the end in x for the bar according to the HP the user has.

Trying to modify the position is kinda just test and error to see if you like it or not.

CHANGING THE POSITION OF THE NAME

But we still have something more to do, right?
The player name is still up there, but we can change that.

NOTE: Before I start this, I have found a major problem with this and it is that this only modifies the position for _your_ character and not everyone else, after I post this I'll be looking into modifying the position of the name of other players as well.

Search for:            ' Draw name
It should look like this:
```
If SpriteSize = 1 Then
        If Index = MyIndex Then
            If lvl >= 1 Then
                TextX = NewX + sx + Int(PIC_X / 2) - ((Len(GetPlayerName(MyIndex) & " lvl: " & GetPlayerLevel(Index)) / 2) * 8)
            Else
                TextX = NewX + sx + Int(PIC_X / 2) - ((Len(GetPlayerName(MyIndex)) / 2) * 8)
            End If

            TextY = NewY + sx - 50
            If lvl >= 1 Then
                Call DrawText(TexthDC, TextX, TextY, GetPlayerName(MyIndex) & " lvl: " & GetPlayerLevel(Index), color)
            Else
                Call DrawText(TexthDC, TextX, TextY, GetPlayerName(MyIndex), color)
            End If
        Else
            ' Draw name
            If lvl >= 1 Then
                TextX = GetPlayerX(Index) * PIC_X + sx + Player(Index).xOffset + Int(PIC_X / 2) - ((Len(GetPlayerName(Index) & " lvl: " & GetPlayerLevel(Index)) / 2) * 8)
            Else
                TextX = GetPlayerX(Index) * PIC_X + sx + Player(Index).xOffset + Int(PIC_X / 2) - ((Len(GetPlayerName(Index)) / 2) * 8)
            End If

            TextY = GetPlayerY(Index) * PIC_Y + sx + Player(Index).yOffset - Int(PIC_Y / 2) - 32

            If lvl >= 1 Then
                Call DrawText(TexthDC, TextX - (NewPlayerX * PIC_X) - NewXOffset, TextY - (NewPlayerY * PIC_Y) - NewYOffset, GetPlayerName(Index) & " lvl: " & GetPlayerLevel(Index), color)
            Else
                Call DrawText(TexthDC, TextX - (NewPlayerX * PIC_X) - NewXOffset, TextY - (NewPlayerY * PIC_Y) - NewYOffset, GetPlayerName(Index), color)
            End If
        End If

```

This is rather more simple than the HP draw. The text just requires X and Y values.
To modify the position in X just add or substract the same ammount to both of the TextX in the code, how? at the end of the line just type + ammount or - ammount, where ammount is the desired value you want to move the name in X.
To modify the position in Y just add or substract at the end of the line of TextY

Remember that if you add to Y you're going to make the text display lower and if you substract you'll make it display higher.
If you add to X you're going to make it move right and if you substract you'll make it move to left.

Hope this helped.

Oh also, there's a lot of things that draw text on top of player like draw player guild, drawnpdamage and all of that. If you wish to go further into modifying the position of the texts you'll have to edit those too.
Just search for DrawText and you'll start getting the results.
Remember that all of this is client side.
I'm going to test out bigger sprite values and if my theory works I'll be making a code for people to easily modify the sprite values say, at the beggining of the code do something like customsize = [insertvaluehere] and you would modify that and the rest is modified.
Also, you could make the sprites class dependant by copying the code and doing like:
If Player(Index).Class = [insertclassnumberhere] Then
[insertcustomspritesizecodehere]
End If

But it would also require you to do the same copy + paste for the engine to load different spritesheets according to the class.
I'm kinda sure that you'd have to do the if stuff with this line:
Set DD_SpriteSurf = DD.CreateSurfaceFromFile(App.Path & "\GFX\Sprites.bmp", DDSD_Sprite)

But these are all just theories that I'll be testing… kinda like next week, I still have some finals left to do.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...