Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

The Meatball Dev

3
Posts
1
Followers
4
Following
A member registered Jul 10, 2015 · View creator page →

Recent community posts

(1 edit)

I'm not familiar with GM, so forgive me if this is completely off the mark: let me make two assumptions about this code:

1. This snippet is run on every frame (i.e. in the game loop)
2. GameMaker reacts immediately to sprite_index being changed (by immediately changing the sprite)

With that in mind, I suspect your move code is affecting your attack code. Each time this script runs (presumably on every frame), sprite_index is reassigned to one of your other sprites in the move code:

if place_meeting(x,y+1,obj_wall) {
    ...
    sprite_index = spr_run_player
    ...
    else sprite_index = spr_test_player
} else {
    ... sprite_index = spr_player_jump; else sprite_index = spr_player_fall ...
}

So in the frame after you first pressed X, sprite_index will begin as spr_player_swing, but there is no scenario where sprite_index emerges from your move code as spr_player_swing (i.e. it's always changed). I assume GM reacts to this by changing the sprite and reseting spr_player_swing's image_index (what frame of the animation its on).

Then, in your attack code, you set sprite_index to spr_player_swing (if X is pressed), but the image_index has been reset! This causes only the first frame of its animation to ever be visible.

To fix this, try restructuring this code into one if/elseif/else tree. This is just a rearrangement, so no other edits are needed (although, judging from other people's code I've been perusing, you don't need sprite_index != spr_player_swing. I suspect GM doesn't react if you set sprite_index to whatever sprite it's already set to).

if place_meeting(x,y+1,obj_wall) {
    if (move!=0)
    ...
}</span> else if keyboard_check(ord('X')) { 
    sprite_index = spr_player_swing
    ...
} else {
    if (vsp < 0) sprite_index = spr_player_jump; else sprite_index = spr_player_fall ...
}

A lot of hunches at play here. Let me know if that helps!

(1 edit)

Hey everyone! I'm no stranger to making games, but I sure am one to finishing them! It's not for lack of trying however. It turns out that one can love tinkering a little too much. I'm an engineer at heart; a long line of prototypes can attest to that.

Consequently I don't get the chance to hone my art/music-fu as often as I'd like. So here's the plan: take a relatively unambitious game idea (perhaps a clone of a classic or a straight-forward platformer) and give it a small twist, but focus mostly on music and art.

But the goal? To finish the game! And if I finish early, maaaybe then I'll get my tinker-fu on.

The best of luck to all of you and have fun!

(2 edits)

Name
V-nought (or Henrik)

Skills & Engines
I do the code thing and have for more moons than I can count. My background is in data science and web development, and I revel in the low-level nitty gritty of physics engines, AI and shaders (though I'm still figuring those out).

I can help anyone with any of those concepts, or with almost any programming at all, but I'm most familiar with:

  • C/C++ (SDL, SFML, Cocos2d-x)
  • C# (Unity)
  • Lua (Love2D)
  • JS (Unity, Phaser.io)
  • Python (PyGame)
  • PHP (if you fancy a web-game or are a masochist, or both)
  • HTML/CSS

Contact
Reach me anytime at contact@v0.io (by email or skype), on Twitter (@vnought) or via bat signal.

Need a teammate?
My plan was to do this solo, using Love2D, so I can practice art and music-making, but I'm willing to team up as either a programmer or [novice] pixel artist/musician, but only under the following conditions (sorry for being picky!):

  • (Only if I'm a programmer) You aren't using an engine (Unity, RPGMaker, Unreal, Construct, etc.)
  • (Only as an artist/musician) Your art/music requirements are within my skill level.
  • You're not doing an MMO, MOBA or visual novel.
  • Not a requirement, but extra points if you're using Rust to code your game! I would love to get to know this language better.