Jump to content


Merlinthewizard

Member Since 10 Feb 2011
Offline Last Active Jan 10 2013 08:04 AM

Topics I've Started

Horizontal platforms code

15 September 2012 - 08:16 AM

Hi GMC. Hope this problem isn't too novice for this forum.

I've made a moving horizontal platforms code for a 2d platform game, and it works exactly how I want it to aside from one thing. Here's the code (placed in the wall object's step event):
repeat abs(horspeed) //horspeed is a variable that designates how fast the platform moves
    {
    var myhorspeed;
    myhorspeed=horspeed;
    x+=1*(horspeed/abs(horspeed))
    if place_meeting(x,y-1,obj_basechar)
        {
        var me;
        me=id;
        with obj_basechar //obj_basechar is the parent object for the player character
        if instance_place(x,y+1,me)
            {
            if !place_meeting(x+1*(myhorspeed/abs(myhorspeed)),y,obj_wall0) //obj_wall0 is, of course, the wall/floor object parent
            x+=1*(myhorspeed/abs(myhorspeed));
            }
        }
    }


What I'd like to do is make it so this doesn't trigger if more than half of the player object is on a non-moving floor, but does trigger if more than half of the player is on a moving floor or no other floor at all. That way it doesn't push the player back if they, for example, stand on a cliff waiting for the platform to come pick them up. Right now when the platform reaches them, it pushes them back all the way onto the cliff because the moving floor is underneath them and it's still moving towards the cliff. Does that make sense?

Anyway, I would be most appreciative if somebody could give me some insight on how to modify this code.

Ways to force them to fight

13 March 2012 - 11:06 AM

Hello GMC. I'm looking to discuss ways one can force the player to fight the enemies in a given level. In a video game, there needs to be a mechanic that will prevent the player from simply skipping through an entire level without battling the enemies you have created.

Common ones involve the following concepts:
  • Physical obstruction, where the player takes damage from an enemy if the touch it (like in Mega Man, Mario, or Castlevania), thus penalizing them if they choose to run through it. I am personally not a big fan of this system because I find it frustrating at times.
  • "Battle rooms," where the player must defeat all of the enemies presented to them in order to continue forward in the level (like in Zelda, Bomberman, or Smash Bros Brawl's story mode). My issue with this one is it doesn't allow the player a lot of freedom.
  • Experience points or score, where the player suffers long term if they do not defeat a certain number of enemies by a certain point in the game (think of any RPG where you have to level and get stronger in order to progress). The problem with this one is it often leads to boring, repetitive, mindless grinding.

Please help me by responding with new ideas or discussing improvements for the ones I stated above. If you can keep your ideas tailored to the 2D platform game genre, I will be extra appreciative. Thanks!

Help with creating an enemy spawning system

22 December 2011 - 12:41 PM

Hello everybody, I'd be very grateful to anybody who would be willing to help me with creating a top down shooter game feature that I am currently stumped on.

A little background: I'm creating a top down shooter (not unlike Raiden) with enemies that spawn in groups which arrive in waves. These enemies come to the player, rather than the player going to them (so the screen never actually moves; the background moves to give the illusion of movement while the enemies are spawned off screen and fly in from the top). So basically the enemies arrive based on a timeline, which pauses at certain points to allow the player to clear existing enemies first. The idea is sort of like Space Invaders in that you have to clear a wave of enemies to get the next one to come.

So here's what I'm stumped on: I have the wave system all figured out--simply write a timeline and write when I want each group of enemies to spawn. However, as you can imagine, if I wrote an instance_create function for every single enemy, it would be really messy and difficult to design. I want figure out how to make a soft code system where I can create groups of enemies in formations without having to write an instance_create function for every single one. Rather, I would just be able to change a few values and it would automatically put the type of enemy I want in the specified place.

I considered using a grid data structure for this where I would be able to theoretically change the values on the grid and the game would spawn enemies in different positions depending on where the values were on the grid, but I'm a noob and have no idea how to do this in a simple way that doesn't use a ton of memory.

If anybody can give me advice on how to go about creating this or even lend me a hand, I would really appreciate it.

How to "link" two objects together

07 December 2011 - 07:34 AM

Hello everybody. This is something I've had problems creating in several games of mine. Let's say I were creating a game where there is one object that creates another object.

For example: an enemy creates a smaller enemy that follows it around but has a separate behavior. Getting the objects to react to each other is easy when there is only one of each instance, but say I wanted to create more? How would I program it so that each instance of the enemy would have its own "sibling" object that didn't react to other instances of the same object?

My first thought was to create a variable that would somehow indicate which object was linked to which. However, I can't seem to figure out how to program such a system. Can anybody help me with this?

Remote bombs in multiplayer game

03 December 2011 - 05:52 AM

Hello GMC. The game I am creating is a two player space shoot-em'-up, not unlike Raiden or Galaga. One of the weapons I want to have accessible are bombs that function similarly to the ones in Star Fox 64, where you press the fire button to launch a bomb, then press it again to detonate it, without allowing another bomb to be created until the first one is destroyed. Because I am using parent objects and softcoding my system (each player is under the same parent object, as are all player created weapons, mostly for simplified collision writing though), this is proving extremely difficult and I can't seem to figure out how to create a variable that ties each bomb specifically to each player. I would prefer to code it under the parent object and not create and write separate codes for each player object individually. Can anybody help me with this? I would be most appreciative. I am GML friendly. Thanks in advance.