Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411281 Posts in 69324 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 06:38:54 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsBLOCPK: Competitive Hoarding: Pickup Artists
Pages: 1 2 3 [4] 5 6 ... 21
Print
Author Topic: BLOCPK: Competitive Hoarding: Pickup Artists  (Read 48434 times)
JLJac
Level 10
*****



View Profile
« Reply #60 on: May 05, 2013, 01:37:29 PM »

Hahaha! Code it so that the upper body has a counter that goes from 0 to 38, and displays the reload animation frame that's indicated by the counter. Then you do the same thing for the lower body, but with a counter that goes to 16 and then starts over Tongue

The key is to not have the lower body ask what the upper body is doing or vice versa.

EDIT: Oh, and sorry for spamming your thread :O I'm sure you know perfectly well what you're doing without me harrasing you!
Logged
Rat Casket
Level 10
*****


i can do what i want


View Profile WWW
« Reply #61 on: May 05, 2013, 01:41:17 PM »

Hahaha! Code it so that the upper body has a counter that goes from 0 to 38, and displays the reload animation frame that's indicated by the counter. Then you do the same thing for the lower body, but with a counter that goes to 16 and then starts over Tongue

The key is to not have the lower body ask what the upper body is doing or vice versa.

EDIT: Oh, and sorry for spamming your thread :O I'm sure you know perfectly well what you're doing without me harrasing you!

No please, spam away. I have beyond infinite respect for you.
Logged

Atnas
Level 4
****



View Profile WWW
« Reply #62 on: May 05, 2013, 01:44:36 PM »



this is the run reload in question. 11 frames buffer to loop it with the 16 frame run animation, but at the end of the reloading it could just switch to the regular run 5 frames in.
Logged

DustyDrake
Level 10
*****



View Profile
« Reply #63 on: May 05, 2013, 01:49:42 PM »

I don't see the upper half affecting the lower half very much here, so it seems like if you just split them it could work fine.
Logged

Rat Casket
Level 10
*****


i can do what i want


View Profile WWW
« Reply #64 on: May 05, 2013, 01:53:32 PM »

I don't see the upper half affecting the lower half very much here, so it seems like if you just split them it could work fine.

It's just as practical to do it the way we are, but the problem is that I can't code for shit.
Logged

JLJac
Level 10
*****



View Profile
« Reply #65 on: May 05, 2013, 02:00:32 PM »

It's just as practical to do it the way we are, but the problem is that I can't code for shit.

What exactly is the problem? I don't think I get this...

If it's this:
Reloading can go into various animations, so standing on frame 22 of reload needs to go into the next frame of reload on a run-reload animation if the player starts running while reload is going. But the run is 16 frames and the reload is around 38

the easiest solution coding-wise would be to draw 16*38 frames, so that every running frame has every reload frame, and then you just put them along different dimensions on a sprite sheet. But that's kind of art-heavy, I guess...
Logged
JMickle
Level 10
*****



View Profile
« Reply #66 on: May 05, 2013, 02:05:07 PM »

the reload animation starts on a particular frame of the run animation

so if you hit reload, it needs to wait until the right frame to start the animation

rabbit needs help with this


i would have a variable called "pressedReload" which is set to 1 when you hit the reload button.

on frame whatever it is (11?) it checks if presssedReload is 1, if it is, it plays the reload animation, does all the reload stuff, then sets pressedReload back to 0.

gm pseudocode: (assuming pressedReload is declared somewhere, like in the create step)
Code:
if (keyboard_check_pressed(ord("R"))) pressedReload = 1;

if (sprite_index == sprRun && image_index == 11 && pressedReload) {
  sprite_index = sprRunReload;
  //your reload stuff here
  pressedReload = 0;
}
Logged

JLJac
Level 10
*****



View Profile
« Reply #67 on: May 05, 2013, 02:12:09 PM »

Aha! So if you picture the running animation as a clock that goes round and round, the reload animation is lined up with hours 1, 2, 3 on that clock? Then you'll just have to wait until hour one. Like JMickle said, you set a boolean to true, and once you reach the right frame you activate "reload mode". But this has to implications - one, reloading will take different amounts of time every time - and two, if you're to start the reload/run animation at the right time after already having reloaded half of it standing still, you're in trouble....
Logged
Rat Casket
Level 10
*****


i can do what i want


View Profile WWW
« Reply #68 on: May 05, 2013, 02:18:17 PM »

I wasn't really asking for help in the thread so much as I was asking for a partner to work on this with me haha but... I will try to explain my current problems.

Right now I have 3 potential states the player can be in.

neutral
shooting
reloading

Here is what my code looks like for shooting, followed by a reload.

Code:
//shooting//
if (aim && onGround && shoot){
    state = "shoot"
}

if (state == "shoot"){
    sprite_index = sRedShoot
    image_speed  = 0.3;
        if(image_index >=9){
            state = "reload"
        }
}
//reloading//
if (state == "reload"){
    sprite_index = sRedReload;
    image_speed  = 0.3;
        if(image_index >=26){
            state = "neutral"
        }
}

It simply states that if you're aiming, and on the ground, and you press the shoot button then youenter the "shoot" state. It plays the animation, and when it reaches the final frame of that animation it jumps into the reload animation.

There are two current problems with this. The first being that the image_index needs to be reset to 0 before the reload animation plays, otherwise it picks up from 10 frames in and it doesn't work correctly. I have tried to set image_index back to 0 but generally it just locks up the animation entirely. The second problem is that you are unable to move at all while this is happening. That's because I'm doing stuff totally wrong and the code simply doesn't allow for movement in the "reload" state. I sort of know how to fix it but I'm not sure where to begin.


You can also see single frame of the jump sprite for some reason at the end of the reload? For some reason the sprite is leaving the ground. Dunno why.

After I get movement working I should just have to link up current frames through various movement options (running/crouching/standing) to make the reload work properly. Again I sort of understand this but I'm also just throwing shit at a wall to see what sticks. /shrug
Logged

JLJac
Level 10
*****



View Profile
« Reply #69 on: May 06, 2013, 12:03:25 AM »

Hm... I don't know anything about game maker, but it seems to me that those are some kind of pre-defined animation system? I actually think that gives you more of a headache than it makes your life easier. Since you didn't make the system yourself, you don't know how it works, and it may surprice you by doing crazy stuff such as trowing in one frame of the jump animation or whatever.

It would maybe be easier for you if you just made every single frame its own "index", and controlled it all with code. Especially since you want to do stuff like moving from one animation into a specific frame of another animation.

I have a golden rule that I always try to keep to - "Never ask a sprite". This means that I never ask the graphics on the screen for information, I only tell them how to look and where to be. You know that you've done this if the game can run flawlessly without updating the postion of any sprites. The reason why doing this is a good thing is that it forces you to not rely on built-in functions but to write everything yourself, in code that you can look at. If you ask the sprites stuff, such as " if(image_index >=26){ " then you suddenly have introuced an unknown in your game, as you can't view or change the code for how the "image_index" relates to "image_speed" and so on.

So, the first thing I would do is to throw out the pre-made animations and create something like this (I've never written game maker code Tongue) :

Code:
on everyTick
maxAnimFrame = 1
if (state == "shoot"){
maxAnimFrame = 5
}else if (state == "reload"){
maxAnimFrame = 38
}

animFrame = animFrame + 1
if (animFrame > maxAnimFrame) {
animFrame = 1
   if (state == "shoot"){
   state = "reload"
   }else if (state == "reload"){
   state = "neutral"
   }
}

sprite_index = "red" & state  & animFrame


That's an embryo of an animation system that you've created yourself, which will in turn help you to control what's going on, instead of leaving you in the hands of mysterious game maker functionality. But then again, I don't even know if this is possible in game maker  Huh?
« Last Edit: May 06, 2013, 12:18:05 AM by JLJac » Logged
Rat Casket
Level 10
*****


i can do what i want


View Profile WWW
« Reply #70 on: May 06, 2013, 05:06:48 AM »

That is very helpful. I'm not sure if its possible either but I can at least give it a shot.
Logged

JLJac
Level 10
*****



View Profile
« Reply #71 on: May 06, 2013, 12:17:48 PM »

Give it a go - if you get it to a state that's somewhere in proximity of working I could give you a hint or two on how to proceed from there.

The good part with this solution is that it will at least solve one of your problems right away: If you line up the run/reload animation with frames 1, 2, 3, 4, 5, and also have a standing/reload animation that's five frames, then it should transition between them smoothly. If you for example stand still the first 2 frames, then start running, it will automatically display frame 3 of the run/reload animation and then continue onwards from there.
Logged
Rat Casket
Level 10
*****


i can do what i want


View Profile WWW
« Reply #72 on: May 06, 2013, 12:23:37 PM »

Yeah, we have all of the reload animations synced up as far as frame count goes.

Hopefully I will have this all resolved within the week.
Logged

siskavard
Guest
« Reply #73 on: May 08, 2013, 07:35:43 PM »

DAMN THAT'S NI- -  oh...
Logged
DustyDrake
Level 10
*****



View Profile
« Reply #74 on: May 09, 2013, 09:32:20 AM »

I died.
Buh-byeeeee!
Logged

siskavard
Guest
« Reply #75 on: May 10, 2013, 02:50:01 PM »

Animation issue... mostly solved.



Lookin' great, but I may be so bold, you could consider doing a run animation instead of speeding up the walk animation for the run.
Logged
Rat Casket
Level 10
*****


i can do what i want


View Profile WWW
« Reply #76 on: May 10, 2013, 07:39:30 PM »

I can't afford to pay Atnas for another sprite right now.

):
Logged

siskavard
Guest
« Reply #77 on: May 10, 2013, 08:59:13 PM »

dam u indie
Logged
Quarry
Level 10
*****


View Profile
« Reply #78 on: May 11, 2013, 01:07:25 AM »

word
Logged
Rat Casket
Level 10
*****


i can do what i want


View Profile WWW
« Reply #79 on: May 11, 2013, 08:06:35 AM »

gibe monie plz
Logged

Pages: 1 2 3 [4] 5 6 ... 21
Print
Jump to:  

Theme orange-lt created by panic