balliztik1 Posted June 22, 2009 Author Share Posted June 22, 2009 **Please note: I did this just as a joke, to show it was possible. It should not be used by a serious game.**Yes, one. One line of code. I have developed a system of 3-frame movement that utilizes just one line of code.Open up the client and view modGameLogic. Find this chunk of code in Sub BltPlayer:``` Select Case GetPlayerDir(Index) Case DIR_UP If (Player(Index).yOffset < PIC_Y / 2) Then Anim = 1 End If Case DIR_DOWN If (Player(Index).yOffset < PIC_Y / 2 * -1) Then Anim = 1 End If Case DIR_LEFT If (Player(Index).xOffset < PIC_Y / 2) Then Anim = 1 End If Case DIR_RIGHT If (Player(Index).xOffset < PIC_Y / 2 * -1) Then Anim = 1 End If End Select```Replace it with this bad boy:```Anim = (((Abs(Player(Index).yOffset + Player(Index).xOffset) - 1) \ 8)) Mod 2 + ((Abs(Player(Index).yOffset + Player(Index).xOffset) - 1) \ 16) * ((((Abs(Player(Index).yOffset + Player(Index).xOffset) - 1) \ 8)) Mod 2)```You now have three frame movement. If you're using 32x64 sprites, you'll have to do the same thing to the BltPlayerTop sub, though. Two lines of code, if you want to be like that.This makes the walking animation change to (Attack, Stand, Step, Stand) instead of (Step, Stand). This merely alters the blitting order. This adds no new frames. If you want to add a completely new frame for walking, separate from attacking, modifications will be needed. Link to comment Share on other sites More sharing options...
dao Posted June 22, 2009 Share Posted June 22, 2009 i get errorexpected )and it highlights the 8 Link to comment Share on other sites More sharing options...
balliztik1 Posted June 22, 2009 Author Share Posted June 22, 2009 Oh, damn. *headdesk*I can't post this because it has integer division which is a forwardslash. Let me try something.EDIT: Okay, it works now. Link to comment Share on other sites More sharing options...
dao Posted June 22, 2009 Share Posted June 22, 2009 ok =p this would be awesome if u got it working Link to comment Share on other sites More sharing options...
balliztik1 Posted June 22, 2009 Author Share Posted June 22, 2009 It is now. It works in the source, it's just that when you go to preview or edit your post in SMF, for some reason, it converts forwardslashes to character literals. It's pretty inconvenient at times. Link to comment Share on other sites More sharing options...
dao Posted June 22, 2009 Share Posted June 22, 2009 actually i think it was my fault it didnt work i took out a line of code on accident. works perfectly now. nice dude lol like 5th annoyance uve done. do another one! i like fixing stuff >.< Link to comment Share on other sites More sharing options...
Sowtis Posted June 22, 2009 Share Posted June 22, 2009 Does it work with the paperdoll and everything else? Link to comment Share on other sites More sharing options...
dao Posted June 22, 2009 Share Posted June 22, 2009 yea Link to comment Share on other sites More sharing options...
balliztik1 Posted June 22, 2009 Author Share Posted June 22, 2009 Yes. This formula just sets up the "Anim" variable. All the rest is generated later based off this number. Everything that normally works in Eclipse still works, except with 3 frames for movement now.The same thing could be done for NPCs, too. Instead of "Player(index).xoffset)" and such, you'd just use the corresponding MapNpc values.Now, I'm not exactly sure if this is more efficient, though. It's very math-heavy, and that might be a source of lag. Honestly, I just made this to show off that it could be done. XD Link to comment Share on other sites More sharing options...
dao Posted June 22, 2009 Share Posted June 22, 2009 lol u make alot of stuff… im glad to see that thers alot of tutorials as i need them to make my game perfecto. Link to comment Share on other sites More sharing options...
Robin Posted June 22, 2009 Share Posted June 22, 2009 @♪♫♪:> Yes. This formula just sets up the "Anim" variable. All the rest is generated later based off this number. Everything that normally works in Eclipse still works, except with 3 frames for movement now.> > The same thing could be done for NPCs, too. Instead of "Player(index).xoffset)" and such, you'd just use the corresponding MapNpc values.> > Now, I'm not exactly sure if this is more efficient, though. It's very math-heavy, and that might be a source of lag. Honestly, I just made this to show off that it could be done. XDShort code is always nice, but replacing a system of simple variable changing to a big-ass calculation could be pretty slow, especially as BltPlayer is called several times every loop.It's nice, but I'll be releasing a simpler version later this week. Link to comment Share on other sites More sharing options...
nnn404 Posted June 30, 2009 Share Posted June 30, 2009 this week?? :icon_meditation: Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now