1
\$\begingroup\$

In YoYo Game Maker Studio: Is there a way (or an already-created library) I can specify all the possible sprite frames and directions in a way I am allowed to do it in Clickteam Fusion?

As far as I read in the docs, I create Sprite resources which are linear: An image resource can be loaded and read in columns and rows, but a single sprite is generated. However, what I want to achieve is the following:

  1. Import a single image with layout like this:

    llll
    rrrr
    uuuu
    dddd
    

    Meaning four frames per direction (left, right, up, down).

  2. Allow my sprite to have four directions. In such case, the animation will involve just the row corresponding to the direction.

  3. Allow the user to stay / not move. In such cases, I would use another image like this (most of the times it would be a subset of the former):

    l
    r
    u
    d
    

Question: Before doing it in the hard way (which for larger games I did in ActionScript already; I'm not net at all at coding) I would like to ask:

  1. Is there an already supported way in the environment to do it? Like managing the related sprites as a set.
  2. Alternatively: Any good 3rd party plugin which already does that?

I have no problem at all with coding the solution on my own, but honestly I would not like to reinvent the wheel.

\$\endgroup\$
3
\$\begingroup\$

Make a new sprite, go to Edit Sprite then File→Create From Stripe... Pick your sprite sheet then it will show it with a grid.

From there you can set number of images and images per row so that your llll are the 4 images for the left direction.

Create From Stripe

You can make new sprites that have multiple images for the other directions, when the player is not moving, etc.

If the player presses a certain key you can change the sprite, like this:

if (keyboard_check(ord('W'))) {
    sprite_index = spr_character_left;
    y -= 1; // move up 1
}

if (!keyboard_check(ord('W'))) {
    image_speed = 0; // 0 animation speed
    sprite_index = spr_character_face_up;
} else {
    image_speed = 0.1;
}

or if you want the sprite to change directions that point to the mouse, make a variable that stores the direction from the object to the mouse:

dir = point_direction(x,y,mouse_x,mouse_y);

if (dir > 90 && dir < 270) { // if direction is within 90 and 270 (left)
    sprite_index = spr_character_left;
}

where the direction ranges are:

directions

Game Maker Manual regarding strips: Designing Games with GameMaker: Strips

\$\endgroup\$
  • \$\begingroup\$ Yep. That's what I was about to fall back (the keyboard case; not the mouse case) but wanted to know if there was a library or an automatic way. \$\endgroup\$ – Luis Masuelli Dec 22 '15 at 14:47
  • \$\begingroup\$ An offtopic question: How did you generate that sprite? Did you use the web page (I saw a generator in a jpn webpage) or do you have a standalone program? \$\endgroup\$ – Luis Masuelli Dec 22 '15 at 14:56
  • \$\begingroup\$ I got that sprite sheet from RPG Maker VX Ace Resources because I'm not so good at making sprite sheets myself but yes you can use whatever is most comfortable or works best for you when making sprite sheets. I think this is as efficient as it gets for setting up sprites in Game Maker, I tried doing all that myself manually with python and it takes quite a while with only code to manage the sprite sheet. \$\endgroup\$ – martinpkmn Dec 22 '15 at 16:25
  • \$\begingroup\$ Have this website to generate sprites like the one in the example famitsu.com/freegame/tool/chibi/index1.html \$\endgroup\$ – Luis Masuelli Dec 22 '15 at 18:20
  • \$\begingroup\$ It's not about making sprite sheets that's a hassle, but implementing the sprite sheets in your game, which is much more efficient with Game Maker's tools. Making sprite sheets is quite simple with Gimp alone, just pixel art design I'm not as good at. \$\endgroup\$ – martinpkmn Dec 22 '15 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.