One weapon object, different weapon sprites

I’m trying to optimize weapon pickup by combining multiple weapon sprites into one object, while changing the player’s animation to match the corresponding weapon they picked it up. Here’s a screenshot of my event editor as I try to re-adapt the event with the optimization:

I’m not sure what you’re after here - you haven’t explained what happens.

But I’d guess that the animations change and firing of bullet doesn’t work, because the key release condition is only checked once when the player is in collision with the weapon.

The weapon is deleted and so the very first event in the screen shot won’t return true after the first time because the weapon is deleted and the condition will not be met.

So, what I want is to make a single “weapon object collision” event that can be applied to all of the “weapon object” sprites which also change the player’s animation depending on the weapon’s sprite. Currently, my event editor look like this:


Note: I pasted the collision event to all other weapon’s sprites.

To understand this, you wanna:
1- Just 2 objects “Weapon and Player” event condition - collision!
2- Change animation Player and Weapon and set in same animation (Example weapon animation 2, player animation 2)
3- JUST 1 event weapon collision player, right?

In personal your events look good, just the event “player collision weapon” are in initial and don’t need repeat in every weapon events. Just put like these

In “Use Weapon” - Event: Player is in collision with Weapon
- Sub-events: Initial, Hand guns, Assault rifle, Shotguns…

That apply in all your weapon events and you can delete that event in concrete!

I did it! It worked! Here’s a screenshot:


It’s still look a little messy, but, thank you very much.

Yes, that’s messy, and a pain to maintain if you add or remove weapons.You can reduce all this down to 1 event :

1 Like

That’s a very good idea! I’ll keep both options, then. Thank you.

Strange. I found out something. When I disable one of the two collision events


This happens:

As you can see in the video, when I pick up the “FullShotgun”(longer shotgun) and the “SASG”(shotgun but semi auto) (Including the “Carbine”. I didn’t record that part, because the twitching is very minimal), the player twitches. I’m not sure what caused it.

Check the origin of your sprites are the same position relative to your player image for all player animations.

I also found out something, too. When I pasted the “weapon collision” event to “NewScene”(the “NewScene2” in the video is a duplication of “NewScene” for testing and adding new things), there’s no twitching. Does that have something to do with the scene?

More likely there’s something further along the events that’s causing it. If just the weapon collision events by themselves don’t cause the twitch, then there’s a good chance some other event is.

You could try disabling all the other event groups, then slowly turning them on one at a time and testing for the twitch with each event group that you enable.

I’m not sure about this, but, this event group could be the source of problem:


I think the selected events in the screenshot are the problem. When I disable the selected events(the enemy events), it caused the twitch. If you want, I’ll provide you all the events in my event editor.

Nothing in those events seem to effect the player position.

Can you screen shot the code for the FullShotgun (the second gun to get picked up in your video link)?

Here:


This is for shooting the “FullShotgun”

This is for the pick up part (the FullShotgun sprite is animation 4).

I’d like to check whether it’s the origin relative to the image that’s causing the issue. Can you give some sprite point screen shots? One of the points on the FullShotgun animation, one of the points on the very first animation (pistol?) and one of the points of the sprite without any weapons?

Here:



That looks fine - you’ve got the origin in the same spot for all animations - in the middle of the purple square character.

I’m a bit out of ideas. If you like to make the project available (either in this thread or by PM), I can take a look and see if I can figure out what’s happening.

Here: https://drive.google.com/file/d/1i5rDkt80uUTMp_pVybaC15wcosvLrROl/view?usp=sharing
If it’s not working, I’ll find another way.

I moved the centre camera on player to the start of the scene, and it fixed it.

But that’s not the way to solve it. I’ll dig a bit deeper and see what I can find.