Help with game mechanic for my project #1

edited in General
Hey guys!

So my game maker game is going well, I have quickly developing prototype with 7 levels and most of the mechanics in place so far. So good :D.

Its a fairly standard side scrolling platformer so far so envision this when I state my problem below.

Now to the topic, I am a bit stuck in implementing one of my main mechanics, as it is a bit more unique than your average game mechanic(jumping, switches etc). I don't even know what or where to begin looking for an example of it and my meager GML skills are still a bit below it, I think. So I am hoping you guys might have some ideas or suggestions of how I can implement it, description will follow:

So in the game the player basically gets the ability to create platforms, ladders, switches etc from seemingly thin air. He does not choose what he can create and the things he creates are specific to the level and important to getting from point A to point B.

Imagine it as a puzzle mechanic. Here is an example: There are two platforms with a wide gap in between, the player cannot make the jump as he is too far, he has to figure out that this is a situation to use his ability to conjure up a middle platform. He does this and success and he is able to cross.(I hope that makes sense).

Currently the controls are arrows for movement and space to activate things. I am thinking perhaps using the mouse pointer(left click and hold) to "rub" over these places to expose the platforms, switches(etc).

Does this seem do-able, any suggestions, hopefully I am making sense :P.

Comments

  • Hi Adonais,

    That sounds pretty cool. Sounds like to could be a fun concept.

    So essentially the player would only be allowed to use one "special power" per level?

    My suggestion would be to create a variable that you can set when each room starts. So for example, if the player needs a ladder, in the creation code for that room you can set that there(obj_specialpower = obj_ladder;).

    You can set the variable(obj_specialpower) to be the object name(obj_ladder), so when you let the player click to place that object, you can say:
    instance_create(mouse_x,mouse_y,obj_specialpower);

    I hope that helps :)

    Thanked by 1Adonais
  • Thanks for the response!

    I like your idea and currently trying to implement it. I am still very new to GML hehe(nervous laugh).
    So I must place that first line of code in the creation code of the room, then where must the other go? In the creation event of the platform/ladder?

    I am going create faint outlines for where the object must appear, so then the player will "colour" it in so to speak, how can I tell the game to place that object then specifically in that outline for instance?

    Thanks in advance, you already helped a lot :D!
  • Ok so I have found another possible solution. I created a quill(pen) that follows the cursor if the player holds in the left mouse button. He can then move this to the desired location and when he touches the right spot the desired object is created. All good it seems.

    So the quill gets created, follows and is destroyed upon release, that all good and well, but then when you press the button again it isn't created anew... any suggestions, my code follows.

    obj_quill

    create event
    //if left mouse button is pressed quill created
    if mouse_check_button(mb_left){
    instance_create(x,y,obj_playerquill);
    }

    step event
    //if left mouse button is held in quill follows the mouse
    if mouse_check_button(mb_left){
    x=mouse_x;
    y=mouse_y;
    }else{ //if it is released obj_playerquill is destroyed
    if mouse_check_button_released(mb_left){
    instance_destroy();
    }}

    What can i do so the quill appears ever time the player holds the button?
  • Looks like you're creating the obj_quill inside itself there? I'm assuming that you've put an obj_quill in the room before the game starts, that means that it's that specific quill that's following the mouse (I'm not even sure the line instance_create(x,y,obj_playerquill); does anything, do you have an object type defined as "obj_playerquill"?

    Then, when you let go of the mouse button, the obj_quill destroys itself. So when you press the mouse button again, no new quill is being created!

    What you need to do is have an object that's always sitting around elsewhere (usually an invisible object) that creates a new obj_quill when the mouse is pressed for you, using instance_create(mouse_x, mouse_y, obj_quill);

    Just as a note: If you want to store a reference to that new quill, you'd do something like this:
    myQuill = instance_create(mouse_x, mouse_y, obj_quill);
    Then whichever object ran that code would have a new variable that you could use to move that specific quill around (myQuill.x would work, etc)
    Thanked by 1Adonais
  • Great! I figured it out with your help! Now I have a quill that spawns and disappears on command and I managed to get the objects to react as well when it touches the right spots.

    Thanks for taking the time to help! Feel like I leveled up :>
  • You game concept reminds me of a game I played when I was still a kid, and for the life of me I have no clue of what it was called.

    Basically it was an adventure kind of game, but there were parts you needed to past, and what you would do is select these "magical" companions you had. There was a magic wand, a pencil, a paintbrush, and an eraser (I think :O).

    At certain sections, only some of them would be relevant, and could fix the problem for you. You couldn't ever fail the level or die (since the game was aimed at kids). But it was pretty cool :D



Sign In or Register to comment.