Pages: 1 ... 6 7 [8] 9 10 ... 64
  Print  
Author Topic: Game Maker Help Thread!  (Read 324993 times)
MagiMaster
Bulb
*
Posts: 97


View Profile
« Reply #105 on: January 23, 2010, 05:40:14 AM »

It would seem to explain why it blows up randomly, but it's just a guess.
Logged
DariusK
Bulb
*
Posts: 97



View Profile WWW
« Reply #106 on: January 23, 2010, 07:50:14 AM »

Most (probably all) objects do actually resolve to x/y velocity of 0 when they're stopped. If you are having trouble debugging it, you can put in this code in the oBombRock Draw event (and change the included variables to anything you want, really):

Code:
    draw_set_font(global.myFontSmall);
    draw_set_color(c_white);
    draw_text(x+16,y-16, string(xVel) + ", " + string(yVel));

This way you can make sure that your trigger variables are correct.
Logged

marsgreekgod
Big Bossy
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #107 on: January 23, 2010, 11:22:23 AM »

It would seem to explain why it blows up randomly, but it's just a guess.
It doesn't blow up at all... or move. just kill me.

but thanks for the check DariusK, I'll use it.
Logged

Show your power, Gun Del Hell! Show them their fate! Yes! Yes! Yes! Yes! Yes! Here we go! Let's go, go, go, go, Django! Light and Dark! It comes down to this! Be afraid, Sun!
ipwnu1337
Guest
« Reply #108 on: January 23, 2010, 12:08:56 PM »

My turn?

Anyway, is there a way to add a new action button?  I'm thinking of creating a new mod, but it requires that I can use right-hand and left-hand weapons.
Logged
DariusK
Bulb
*
Posts: 97



View Profile WWW
« Reply #109 on: January 23, 2010, 12:49:21 PM »

Sure. If you're going to do this totally properly, you would need to edit the config.exe to provide a new keybinding (so people can set your new action key to whatever they want). Writing proper controls where gamepads, joysticks, and keyboards all work the way you expect them to and can be bound to different values is a HUGE thing and I don't want to write up a whole tutorial on that. So I'll skip that and just assume you want to hardcode a new key. So let's say you want 'V' to be a button that creates a yeti. I dunno why you'd want to do that, but let's just say you did Smiley

First you go to the scrInit script and add a new global. You'll see all these global.key**** values. Add a new one, something like

Code:
global.keyYetiVal = ord('V');

There's some gamepad code underneath that, and there's more code under that for importing key values from the config files. But like I said, I'm not covering that.

Next you'll see there's a bunch of scripts under the "Control" directory, stuff like checkAttack, checkAttackPressed, checkAttackReleased. Copy those three but rename them checkYeti, checkYetiPressed, checkYetiReleased. Then in each one of those you modify them to look like this, by commenting out the first three lines and replacing the attack global with your new yeti global:

Code:
//if (gamepad.attack)
//    return gamepad.attack;
//else
    return (keyboard_check(global.keyYetiVal));

Again, if we were doing gamepad stuff this would break everything, but leaving it in without doing proper gamepad code will screw things up.

Actions are handled in the oPlayer1 Step event, in the second block of code. What you put here really depends on how you want your button to behave. But let's assume our Yeti spawning behaves like attacking does: you can't do it when you're ducking or transitioning from a hang, or if you're already attacking, or exiting a level. So we'll insert our code where I indicate below, at line 805:

Code:
    if (kAttackPressed and state != DUCKING and state != DUCKTOHANG and not whipping and
        sprite_index != sPExit and sprite_index != sDamselExit)
    {
        image_speed = 0.6;
        if (global.isTunnelMan)
        {
            if (platformCharacterIs(ON_GROUND))
            {
                sprite_index = sTunnelAttackL;
                image_index = 0;
                whipping = true;
            }
        }
        else if (global.isDamsel)
        {
            sprite_index = sDamselAttackL;
            image_index = 0;
            whipping = true;
        }
        else
        {
            sprite_index = sAttackLeft;
            image_index = 0;
            whipping = true;
        }
    }
    // BEGIN NEW CODE
    else if (checkYetiPressed() and state != DUCKING and state != DUCKTOHANG and not whipping and
        sprite_index != sPExit and sprite_index != sDamselExit)
    {
       //// YOUR STUFF HERE
    }   
    // END NEW CODE
    else if (kAttackPressed and kDown)
    {
        // pick up item
        if (collision_rectangle(x-8, y, x+8, y+8, oItem, 0, 0))
        {
           ...

So, yeah. That's the quick and dirty way, but again, it'll take a lot more work to make the keys rebindable and working on all sorts of controllers. I may write a tutorial about that some day. But it's boring. You know what is NOT boring? A video of my yeti-launching Spelunky mod Smiley

http://www.youtube.com/watch?v=rPOXbLp73oM
Logged

marsgreekgod
Big Bossy
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #110 on: January 23, 2010, 12:53:52 PM »

I am going to make a mode where you don't whip. you fire dead things at people,.
Logged

Show your power, Gun Del Hell! Show them their fate! Yes! Yes! Yes! Yes! Yes! Here we go! Let's go, go, go, go, Django! Light and Dark! It comes down to this! Be afraid, Sun!
gummybears123
Mossy
*
Posts: 5785


Yummy Gummy!


View Profile
« Reply #111 on: January 23, 2010, 12:55:15 PM »

Dead things?
Logged

I made a rap.
It sounds dumb, like reading a map
I really should stop this thing before it goes too far
But I don't really car as long as I stay below the radar
Those big companies won't get me no
I'll get away before the fuzz show

-Most famous rapper of Mossmouth
Kirbylord
marsgreekgod
Big Bossy
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #112 on: January 23, 2010, 01:09:27 PM »

Yes. things that are dead.
Logged

Show your power, Gun Del Hell! Show them their fate! Yes! Yes! Yes! Yes! Yes! Here we go! Let's go, go, go, go, Django! Light and Dark! It comes down to this! Be afraid, Sun!
gummybears123
Mossy
*
Posts: 5785


Yummy Gummy!


View Profile
« Reply #113 on: January 23, 2010, 01:22:05 PM »

Like dead damsels and stuff?
Logged

I made a rap.
It sounds dumb, like reading a map
I really should stop this thing before it goes too far
But I don't really car as long as I stay below the radar
Those big companies won't get me no
I'll get away before the fuzz show

-Most famous rapper of Mossmouth
Kirbylord
marsgreekgod
Big Bossy
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #114 on: January 23, 2010, 01:43:14 PM »

No dead rocks.

Yes I do mean like dead damsels and yetis and stuff.
Logged

Show your power, Gun Del Hell! Show them their fate! Yes! Yes! Yes! Yes! Yes! Here we go! Let's go, go, go, go, Django! Light and Dark! It comes down to this! Be afraid, Sun!
gummybears123
Mossy
*
Posts: 5785


Yummy Gummy!


View Profile
« Reply #115 on: January 23, 2010, 01:52:29 PM »

What else are u putting in the mod?
Logged

I made a rap.
It sounds dumb, like reading a map
I really should stop this thing before it goes too far
But I don't really car as long as I stay below the radar
Those big companies won't get me no
I'll get away before the fuzz show

-Most famous rapper of Mossmouth
Kirbylord
banna8
Mossbaby
*
Posts: 281


View Profile Email
« Reply #116 on: January 25, 2010, 08:55:52 AM »

Ok, I just recently got pro, and wanted to start editing/modding spelunky. I was using primarily drag and drop before.
I'm looking for the parts of the code involving input. (walking,running,jumping,ducking......) I have already found the attack ones though! (I think)


EDIT: Maybe I got it, its in scripts right? Sorry, I was looking in objects.
« Last Edit: January 25, 2010, 09:02:06 AM by banna8 » Logged
DariusK
Bulb
*
Posts: 97



View Profile WWW
« Reply #117 on: January 25, 2010, 09:20:53 AM »

There is a script called "characterStepEvent" that is called from inside the oPlayer1 object's step event. This reads all the input in terms of up/down/left/right movement.
Logged

banna8
Mossbaby
*
Posts: 281


View Profile Email
« Reply #118 on: January 25, 2010, 10:20:34 AM »

Thanks, I went to the characterStepEvent script, and inserted this:

Code:
if (kJumpPressed and global.isDamsel and yVel >= 0 and float > 0)
{  
     yVel = 0
     yAcc = 0
     float = float - 1
     sprite_index = sDamselHoldL
}
  

I also made it that you automatically are Damsel (global.isDamsel is true)
and put this in the oPlayer1 step code:

Code:
if (global.isDamsel and platformCharacterIs(ON_GROUND))
{
    float = 300
}

and this in characterCreateEvent :

Code:
float = 0

I spawn as Damsel (as hoped), but it effectively stops me from jumping, instead of allowing me to float at the peak of my jump (as planned). Please Help!

EDIT: also something weird happens with the whip..
all whip, and then act as if I was floating(as planned) but on the ground Sad
« Last Edit: January 25, 2010, 10:31:10 AM by banna8 » Logged
marsgreekgod
Big Bossy
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #119 on: January 25, 2010, 12:08:18 PM »

well thatch because you start floting as soon as you press the jump key! you need some kind if (whatever state there is for in the air) so you have to double press it to float.
Logged

Show your power, Gun Del Hell! Show them their fate! Yes! Yes! Yes! Yes! Yes! Here we go! Let's go, go, go, go, Django! Light and Dark! It comes down to this! Be afraid, Sun!
Pages: 1 ... 6 7 [8] 9 10 ... 64
  Print  
 
Jump to: