chrismaltby / gb-studio

A quick and easy to use drag and drop retro game creator for your favourite handheld video game system
https://www.gbstudio.dev
MIT License
8.52k stars 469 forks source link

[Request] Checking an Actor's position and the direction an Actor is facing #33

Closed KizulEmeraldfire closed 4 weeks ago

KizulEmeraldfire commented 5 years ago

At current with GB Studio, you can make puzzle games (e.g. maze games, block-pushing puzzle games like Sokoban (or Boxxle/Boxxle 2, if you want an actual Game Boy example)), adventure games like Fairune, "walking simulators"…

But you can't make an adventure game where the player can interactively attack things (like stabbing/slashing with a sword, or shooting a gun/magic wand), like Rolan's Curse (and Rolan's Curse II, its rarer sequel), The Legend of Zelda: Link's Awakening, or Final Fantasy Adventure, because it's impossible to script a weapon for the player.

My first thought for how this could be done was hiding an Actor somewhere to be used as the weapon (a sword, in this example), and having its script get triggered when the player presses the "B" button.

The script would basically work as follows:

  1. Make the player unable to move until the script finishes
  2. Set player's sprite sheet to one where the player is making a stabbing motion
  3. Set the weapon Actor's position to the player's X/Y coordinates
  4. Show the weapon's Actor, with its direction set to whatever direction the player is facing
  5. Set the weapon Actor's position to the player's X/Y coordinates plus or minus one, and then plus or minus two (a total of 16 pixels of movement) to simulate a stabbing motion
  6. If the weapon Actor collides with another Actor, hide* the Actor with which the weapon Actor collided
  7. Set the weapon Actor's position to the player's X/Y coordinates plus or minus ONE, to make it appear to be drawing back
  8. Hide weapon Actor
  9. Set player's sprite sheet back to normal
  10. Allow player to move again

…But there's currently no ability to place or move an Actor/set an Actor's position to coordinates relative to another Actor's X/Y coordinates, nor the ability to check the direction that an Actor is facing.

Also, this script could probably be simplified — but like I said: this was my first thought.

Of course, GB Studio is only at version 1.0.0, and I'm not expecting it to have every feature that everyone wants right off the bat, but I thought I'd throw in my 2¢. :)

*Alternatively, check which Actor the weapon Actor collided with and then check an appropriate "HP" variable for that Actor. If the variable's value is greater than 1, decrement the value, and have the Actor become Hidden when the value reaches 0.

DerekLF commented 5 years ago

Just to summarize your idea. You want to be able to make an Actor hold a Weapon, move the Actor and the Weapon, move the Weapon separately from the Actor, get another IF loop(IF actor is within weapon range), and convert the X and Y coordinates of any Actor to a usable variable. correct?

I was making an non combat RPG but if this get added I'll have to add combat

KizulEmeraldfire commented 5 years ago

Just to summarize your idea. You want to be able to make an Actor hold a Weapon, move the Actor and the Weapon, move the Weapon separately from the Actor, get another IF loop(IF actor is within weapon range), and convert the X and Y coordinates of any Actor to a usable variable. correct?

Basically, though to clarify that list further:

I personally don't think that GB Studio really needs a hard-coded combat system, but the features I just listed in this post would be crucial to making it myself — plus they could potentially be used for other things. :)

Also, I actually just realized that a game with combat like Fairune's actually can't be made in this engine (yet), because Actors can't Move over each other: thus, the player can't just "walk over the monster" to defeat it. So, in addition to the above options I listed, maybe also add:

This could be coupled with checking a Variable's value to determine whether the player should be able to walk through the Actor or not. :)

I was making an non combat RPG but if this get added I'll have to add combat

Hey, non-combat games are cool, too! :) I just wanted to suggest some new Scripting Events and such for being able to create my own combat system.

fuzzymannerz commented 5 years ago

+1 for checking the actor/player direction.