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

Attack Frame - Working


Xlithan
 Share

Recommended Posts

I think something was missed out of the last tutorial that was posted about adding an attack frame because it didn't work for me, so here's one that works if anybody else had trouble.

Now then. If your sprites are 32x32 each, add an extra 32 pixel width to your sheet and do your extra frame there.

Look for **Public Sub BltPlayer**, and do the following within that sub.

Replace:
```
            If Player(Index).Attacking = 1 Then
                Anim = 3
            End If

```With:
```
            If Player(Index).Attacking = 1 Then
                Anim = 4
            End If

```
Replace:
```
        .top = spritetop * (DDSD_Character(Sprite).lHeight / 4)
        .Bottom = .top + (DDSD_Character(Sprite).lHeight / 4)
        .Left = Anim * (DDSD_Character(Sprite).lWidth / 4)
        .Right = .Left + (DDSD_Character(Sprite).lWidth / 4)

```With:
```
        .top = spritetop * (DDSD_Character(Sprite).lHeight / 4)
        .Bottom = .top + (DDSD_Character(Sprite).lHeight / 4)
        .Left = Anim * (DDSD_Character(Sprite).lWidth / 5)
        .Right = .Left + (DDSD_Character(Sprite).lWidth / 5)

```
Replace:
```
    ' Calculate the X
    x = GetPlayerX(Index) * PIC_X + Player(Index).XOffset - ((DDSD_Character(Sprite).lWidth / 4 - 32) / 2)

```With:
```
    ' Calculate the X
    x = GetPlayerX(Index) * PIC_X + Player(Index).XOffset - ((DDSD_Character(Sprite).lWidth / 5 - 32) / 2)

```
Save, test.
Link to comment
Share on other sites

@Xlithan:

> Yeah, but that was the case prior to the tutorial. This only shows how to add the extra frame. Displaying it globally was my next job but feel free to share it if you do figure it out before me.

Yeah, I'm not sure I'll do this right away. It turns out you need to edit paperdolls to work right aswell
Link to comment
Share on other sites

Yeah I guess you could do that as well. Depends if you plan on actually adding more than 1 extra frame in the future.

From an engine perspective I can see the benefit, it's one less thing for people to make an effort for, when they can just edit 1 number.
But coding an engine and coding a game are 2 completely different things.

Most of the things you see in external files can be hard coded. The only reason why some things are in external files, especially in older Mirage source is because they were based on closed source engines, which meant having to have these external files in order for the admin to make changes, like having a data file with all the MAX_ shit that can just be hard coded. Even the options.ini and classes.ini can be hard coded once you've gotten the stats set up right.

Unless it's something which will change frequently, hard code it, reduce the amount of files your game uses.
I think Robin pretty much had this in mind when he made Eclipse Origins so it's not such an issue in this version.
Link to comment
Share on other sites

  • 3 weeks later...
Good luck getting these "new frames" to show up on other players playing your game(s).

If you want direction, look at how movement frames are kept synchronous with the server and other players (attack frames don't show up on other players either).
Link to comment
Share on other sites

@iXlithan Thanks man, this really helps me. I converted this to work with the paperdoll, it's not hard. I also converted this to work with NPCs, which i think is very useful. I'm going to try and figure out how to get this to work globally.

@MrMiguu Thanks for the tip, That's exactly what I plan to do.
Link to comment
Share on other sites

Well from what I've seen so far, bltplayer handles the rendering of all the players on the same map as you. So seeing that, I placed code that would find out who is attacking, set them to attacking on my client, then blt THAT player, with attacking set (along with the attacktimer) it should render the person attacking, but it's not blting properly, it only shows the first frame until my character attacks, then it "catches up" so to speak.
Link to comment
Share on other sites

@Deathfissure:

> Well from what I've seen so far, bltplayer handles the rendering of all the players on the same map as you.

Not exactly.

It handles variables to determine frames, as well. The only frame that correlates to every player on the same map as you is the _.Step_ variable for the player. That determines movement frames.
Link to comment
Share on other sites

How is it a problem showing globally? Works just fine.

The only issue Origins has in this regard is that the server will not send out the attacking packet if you're not actually attacking anything.

Move the attack packet to the start of the battle logic so it doesn't get skipped on an early exit and it should work just fine.

Showing things 'globally' is just a case of keeping people's clients synced whilst keeping data usage to a minimum. It's a juggling act, but not a hard one.
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...