Animation issues  

Tweet b3d
(Posted 8 months ago) eqanox126

I am fairly new to Blitz3d and have been using tutorials I found everywhere to try to put something together for an upcoming final project. I believe its this lack of knowledge that landed me in a lot of issues. I was originally planning to make a 2d platform fighter game but I was unable to figure it out so i decided to make a 3d fighter arena. After days of going through videos, I figured out how to do the animations for my character but when ever I call for the animation, it doesn't occur instantly. It instead plays my idle animation which also doesn't work well. After holding the button down for sometime the animation plays. I am honestly cramped in time and any ideas will help.

My second main issue is making a realistic gravity that syncs with the jumping animation. All the gravity code i found just making my character fly.

I have so many other issues like making health bars, numbers showing dmg delt, the scenery, and the collisions but i believe i can figure out these later.

please look at my code. All help will be appreciated

     Graphics3D 940,640
        SetBuffer BackBuffer()

        Const Upkey= 200
        Const Downkey =208
        Const Rightkey = 205
        Const Leftkey = 203
        Const spacekey = 57
        Const Akey = 30
        Const Skey = 31
        Const Dkey = 32

        player = 2

        camera = CreateCamera()
        ;PositionEntity camera, 266,0,-100
        PositionEntity camera ,0,20,-35

        light = CreateLight()
        RotateEntity (light,90,0,0)

        man = LoadAnimMesh("combo1.b3d")
        ScaleEntity man, 0.1,0.2, 0.2
        RotateEntity man, 0,0,0
        EntityType man,type_player

        EntityParent camera, man

        cubeworld = CreateCube()
        PositionEntity cubeworld,1.5,2,6
        FitMesh cubeworld, -250,-200,-250,1000,500,500
        FlipMesh cubeworld
        tex_sub =LoadTexture("subway.jpg")
        ScaleTexture tex_sub ,1.5,1.5 
        EntityTexture cubeworld, tex_sub
        EntityFX cubeworld, 1
        EntityType cubeworld,type_ground 

        RotateTexture tex_sub ,180

        RotateEntity cubeworld ,90,0,0

        ground =CreateTerrain(512)
        EntityColor ground, 50,136,32 
        PositionEntity ground, -500, -5, -500 
        ScaleEntity ground, 100,100,100
        EntityRadius ground, 5
        EntityType ground,type_ground

        idle = ExtractAnimSeq(man, 2,100)
        jumping = ExtractAnimSeq(man, 190, 245)
        running = ExtractAnimSeq(man, 125, 140)
        rightpunch = ExtractAnimSeq(man, 322, 352)
        leftpunch = ExtractAnimSeq(man, 353, 385)
        slide = ExtractAnimSeq(man, 141, 187)
        kick = ExtractAnimSeq(man, 246, 321)

        Collisions type_player,type_ground,2,2
        Collisions type_ground, type_player,2,2

        ;ScaleEntity ground, 10, 15,10 

        While Not KeyDown(1)

        If KeyHit(spacekey)=True And jumpflag = False
            jumpflag = True

        If jumpflag = True
            TranslateEntity man,+0,+3,+0 ;need 2 units in order to counteract gravity
            If MilliSecs() > oldtime+500 Then jumpflag=False

        TranslateEntity man, 0,-0.9,0

        If KeyDown(Upkey) Then MoveEntity man, 0,0,1
        If KeyDown(Downkey) Then MoveEntity man, 0,0,-1
        If KeyDown(Rightkey) Then TurnEntity man, 0,-1,0
        If KeyDown(Leftkey) Then TurnEntity man, 0,1,0
        ;If KeyDown(spacekey) Then MoveEntity man, 0,1,0


        If KeyDown(Upkey) Or KeyDown(Downkey) Or KeyDown(Rightkey) Or KeyDown(Leftkey) Then 
      runningstarts = True

      Text 0,20,"running"


                runningstarts = False


        If AnimTime(man) => AnimLength(man)-1

        If runningstarts = True

                Animate man,1,0.5,running,10.0


        End If 


        If KeyDown(Skey) Then 
            slidestart= True 

            Text 0,20,"slide"


      slidestart= False


        If AnimTime(man) => AnimLength(man)-1

    If slidestart = True 
        Animate man,1,1,slide,10.0




        If KeyDown(spacekey) Then 

        Text 0,20,"jump"


        jumpstart = False

        If AnimTime(man) => AnimLength(man)-1

        If jumpstart = True
                    Animate man,1,1,jumping,10.0
        End If 



        If KeyDown(Akey) Then 
            punchrightstarts = True 

        Text 0,20,"punchright"


        punchrightstarts = False
        End If 

        If AnimTime(man) => AnimLength(man)-1

        If punchrightstarts = True
                Animate man,1,1,rightpunch,10.0



        If KeyDown(Dkey) Then 
            punchleftstarts = True 

        Text 0,20,"punchleft"


        punchleftstarts = False
        End If 

        If AnimTime(man) => AnimLength(man)-1

        If punchleftstarts = True
                Animate man,1,1,leftpunch,10.0


        If Not runningstarts Or punchrightstarts Or punchleftstarsts Then

        Animate man,1,1,idle,10.0







I am sorry if i am the wrong for reposting the post. I am very confused and don't know what to do.
So sorry!

(Posted 8 months ago) RonTek commented:

Hey welcome to the forums eqanox126!

You can check out the SimpleFPS resource for the gravity and basic movement controls

As for the animation and the code, perhaps you can send over a sample of your animated model or perhaps a draft copy with the assets of your project. You can also try to test it on a separate program first to quickly check if all your animations are in place.

No worries on the double post, it happens and will just fix it asap.

(Posted 8 months ago) eqanox126 commented:

Thank you for replying!

I used Mixamo to create the model then attached all my animations to one script using Cinema 4D.

I am fairly sure all my animations are there, it's just that isn't working properly when called for.
I was wondering how I could send the file of the model + my Blitz3d code over?


(Posted 8 months ago) RonTek commented:

I see. try tiny upload, it's fast and easy:

(Posted 8 months ago) eqanox126 commented:


My Mixamo animation character is in the link below

Here's my blitz code.

Thank you so much for all the help.

(Posted 8 months ago) RonTek commented:

Ok great. Animate command should start (recommended) before your update/renderworld loop, but it still depends on your code flow and animated model (if w/o t-pose or default to idle animation for example)

Animate man,1,0.5
While Not KeyDown(1)
    your game loop

I think you should be familiar first on how blitz animation works, the animation related commands and where to place them before you move forward with your scene as this will be easier for you. The Blitz3D samples and manual examples is a good place to start and of course, feel free anytime to ask away here if you are stuck on something.

So I would suggest stripping out the other parts and starting out again with only the animation related code and controls and then place the other parts piece by piece and make sure to test each one in along the way.

Hope that helps.

(Posted 8 months ago) RonTek commented:

I have added a quick tutorial here:

hope you don't mind sharing the model for now, I will replace it with one of the b3d model included in the samples.

(Posted 8 months ago) eqanox126 commented:

Amazing, I get what you mean. I am so happy i came to this forum.

You can share the model. I would love to do my part in helping anyone who ever encounters this problem in the future.
I just finished fixing all my codes and realized that the animation freezes when spammed pressed. I am very certain that the keys will be spammed when the games is done. I was wondering if there is a way to lock out keys after the first press.

I found this code for another post i was reading and was wondering if it could still apply to the else if set up

Global PunchIsRunning=0
Const ONE_SHOT=3 
If PunchIsRunning=1 ;animation starts
         Animate man, ONE_SHOT, 1, punching
ElseIf PunchIsRunning=2 ; animation already running
 If AnimationTime=99
      PunchIsRunning=0 ;reset,when ready     
ElseIf KeyDown(30) Then

I will probably be back with some new problem. Please bare with me!!

Thank you so much

(Posted 8 months ago) eqanox126 commented:


I was wondering if you have any tutorials for making a in game menu?

(Posted 8 months ago) RonTek commented:

Sure thing and that's great, glad you got this now sorted out.

I found this code for another post i was reading and was wondering if it could still apply to the else if set up

Try it and would be better if you can understand the logic or flow behind it or what you are trying to accomplish. It's a few lines of code so I am sure you can manage.

I was wondering if you have any tutorials for making a in game menu?

You can try Draw3D2, it's one of the most cutting edge Blitz3D gui library:

If you are looking for game states, I will try to post some resources later.

(Posted 8 months ago) eqanox126 commented:

Thank you so much for your help, I honestly thought i was waay over my head and was about to give up but the codes you send helped a lot. I still have some issues with animations tho.

The code i mentioned early made sense when i read it out, " if the animation is still running, stop the animation from repeating when the key is pressed, then when the animation is done its last frame return to the variable that allowed the key to call for the animation." it made lots of sense but when i implemented, steps 1 and 2 worked but it refused to reset and stopping me from re-punching.

After this problem, all i have left is a simple A.I that plays the animations to fight against and i will be mostly done. ( im not sure if this is possible)

we are near the end. Thank you for your help, when we're done I'll see if i can send you the finished code to post in the forums to help any other.

(Posted 8 months ago) RonTek commented:

Hey, glad to help and sounds good. I see, perhaps you can just post again your progress code just the part with the issue along with the assets

For the menu system, try this psuedo code flow:

While MenuAction = 0
; Menu Stuff Here
; If Play Button Goto Play
; If Exit Button : End

While Not Keyhit(1)
; Real GameSttuff Here
Goto Menu
(Posted 8 months ago) RonTek commented:

btw, since this is under Help section, you can tick the check button at the top right side of a comment/reply where you found the solution. This way others can easily find answered topics that might be related to their searches. cheers

(Posted 8 months ago) eqanox126 commented:

Oh Thanks, i just got back from school and about to take a look at the menu code, It seems like a perfect place for me to start and get introduced into how the menu codes work. For my update on the animation, i think i further messed it up while playing around with it. i have the code and the animation mesh linked below.

Honestly, i might just check mark the entire forum. Every thing you have sent has improved my knowledge so much (my mesh)

Hope you're having a good day

(Posted 8 months ago) RonTek commented:

Honestly, i might just check mark the entire forum. Every thing you have sent has improved my knowledge so much. (my mesh)
Hope you're having a good day

sounds awesome! will check it out.. good day!

btw, here's the info link about marking solved problems:

  (Posted 8 months ago) RonTek commented:

Everything looks good so far you just need to fine tune it, particularly the running part and others in between. Since this type of 3d fighting game mechanics or 3d character animation control is common nowadays, it will be not that hard to adapt pseudo code to bllitz.

I will try and see if I can point out and suggest specific resources and links.

Update: posted an old snippet that fix the running and idle part


(Posted 8 months ago) eqanox126 commented:


Thank you so much for all your help. The animation code works for now. I am gonna devote some more time to find a way to make it all better, but for now its perfect

Thanks so much

(Posted 8 months ago) RonTek commented:

Great! glad to hear that eqanox. keep us posted with your progress.

Reply To Topic (minimum 10 characters)

Please log in to reply