Pages: 1 ... 5 6 [7] 8 9 ... 64
  Print  
Author Topic: Game Maker Help Thread!  (Read 311527 times)
hyperme
Mosskid
*
Posts: 888



View Profile
« Reply #90 on: January 21, 2010, 03:33:12 PM »

How do I make something a light source for dark levels?  The next release of SE+ depends on this!
Logged
DariusK
Bulb
*
Posts: 97



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

It's in the oScreen object, in the Begin Step event, line 156.

Code:
  else if (isLevel() and instance_exists(oPlayer1))
    {
        if (global.darkLevel and not oPlayer1.dead)
        {
            surface_set_target(darkSurf);
            draw_set_color(c_black);
            draw_rectangle(0, 0, screen_w, screen_h, false);
            draw_set_color(make_color_rgb(255-255*oLevel.darkness,255-255*oLevel.darkness,255));
            if (instance_exists(oLampRed))
            {
                with oPlayer1
                {
                    distToLamp = distance_to_object(oLampRed);
                    if (distToLamp <= 96)
                    {
                        draw_set_color(make_color_rgb(255-distToLamp,120-(96-distToLamp),120-(96-distToLamp)));
                    }
                }
            }
            if (instance_exists(oLampRedItem))
            {
                with oPlayer1
                {
                    distToLamp = distance_to_object(oLampRedItem);
                    if (distToLamp <= 96)
                    {
                        draw_set_color(make_color_rgb(255-distToLamp,120-(96-distToLamp),120-(96-distToLamp)));
                    }
                }
            }
            draw_circle(oPlayer1.x-view_xview[0], oPlayer1.y-view_yview[0], 96-64*oLevel.darkness, false);
            with oFlare
            {
                draw_circle(x-view_xview[0], y-view_yview[0], 96, false);
            }
            with oFlareCrate
            {
                draw_circle(x-view_xview[0], y-view_yview[0], 96, false);
            }
            with oLamp
            {
                draw_circle((x+8)-view_xview[0], (y+8)-view_yview[0], 96, false);
            }
            with oLampItem
            {
                draw_circle(x-view_xview[0], (y-4)-view_yview[0], 96, false);
            }
            with oArrowTrapLeftLit
            {
                draw_circle((x+8)-view_xview[0], (y+8)-view_yview[0], 32, false);
            }
            with oArrowTrapRightLit
            {
                draw_circle((x+8)-view_xview[0], (y+8)-view_yview[0], 32, false);
            }
            with oTikiTorch
            {
                draw_circle((x+8)-view_xview[0], (y+8)-view_yview[0], 32, false);
            }
            with oFireFrog
            {
                draw_circle((x+8)-view_xview[0], (y+8)-view_yview[0], 32, false);
            }
            with oSpearTrapLit
            {
                draw_circle((x+8)-view_xview[0], (y+8)-view_yview[0], 32, false);
            }
            with oSmashTrapLit
            {
                draw_circle((x+8)-view_xview[0], (y+8)-view_yview[0], 32, false);
            }
            with oExplosion
            {
                draw_circle(x-view_xview[0], y-view_yview[0], 96, false);
            }
            with oLava
            {
                draw_circle((x+8)-view_xview[0], (y+8)-view_yview[0], 32, false);
            }
            with oScarab
            {
                draw_circle((x+8)-view_xview[0], (y+8)-view_yview[0], 16, false);
            }
            with oGhost
            {
                draw_circle((x+16)-view_xview[0], (y+16)-view_yview[0], 64, false);
            }
            surface_set_target(screen);
            draw_set_blend_mode_ext(bm_dest_color, bm_zero);
            draw_set_alpha(1);
            draw_surface(darkSurf, 0, 0);
            draw_set_blend_mode(bm_normal);
        }

If you want it to just light up like a scarab or whatever, you can just add:

Code:
           with oYourObject
            {
                draw_circle((x+8)-view_xview[0], (y+8)-view_yview[0], YOURSIZEHERE, false);
            }

Where YOURSIZEHERE is the radius of the circle in 16-pixel tiles (so a value of 16 would illuminate two tiles all around from the center, 8 would just illuminate the one tile, etc).

If you want it to behave more like a lamp, where the closer you get the brighter the screen gets, you'll just want to copy the lamp code:

Code:
if (instance_exists(oYourObject))
            {
                with oPlayer1
                {
                    distToLamp = distance_to_object(oYourObject);
                    if (distToLamp <= 96)
                    {
                        draw_set_color(make_color_rgb(255-distToLamp,120-(96-distToLamp),120-(96-distToLamp)));
                    }
                }
            }
« Last Edit: January 22, 2010, 03:40:04 PM by DariusK » Logged

Arucard
Mossy
*
Posts: 2811


Hey! Is that CANDY?!?!?

Arucard.Tepes
View Profile Email
« Reply #92 on: January 22, 2010, 08:57:09 AM »

This is why your nick-name is now Proffessor K.  Grin
Logged

Oh, they look like monsters to you?

There's a light in the darkness of everybody's life.
gummybears123
Mossy
*
Posts: 5785


Yummy Gummy!


View Profile
« Reply #93 on: January 22, 2010, 04:01:26 PM »

Dr. K sounds better
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
Kirby
Mossy
*
Posts: 1502


Too Long Away

nrmario@hotmail.com
View Profile WWW
« Reply #94 on: January 22, 2010, 04:54:14 PM »

Anyone know where the sprite for the rubble on top of blocks are?

Like the cave, lush, ice, temple blocks. There's some rubble on top that I can't seem to find the sprite for.
Logged

I'm learning Japanese!
Add me on Steam! http://steamcommunity.com/id/KirbyLord/
Arucard
Mossy
*
Posts: 2811


Hey! Is that CANDY?!?!?

Arucard.Tepes
View Profile Email
« Reply #95 on: January 22, 2010, 07:06:55 PM »

You mean the little bumpy stuff that forms on top of the blocks?(in each level's folder under Block ending with the suffix "top") Or the actual rubble left when they are destroyed? (under the "effects" folder starting with sRubble)
Logged

Oh, they look like monsters to you?

There's a light in the darkness of everybody's life.
Kirby
Mossy
*
Posts: 1502


Too Long Away

nrmario@hotmail.com
View Profile WWW
« Reply #96 on: January 22, 2010, 08:16:49 PM »

Both, thanks for your help. Going to finish up this mod now.
Logged

I'm learning Japanese!
Add me on Steam! http://steamcommunity.com/id/KirbyLord/
marsgreekgod
Big Bossy
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #97 on: January 22, 2010, 08:29:14 PM »

help! my bomb rock doesn't seem to work right. How would one make a rock that blows up when ever it stops, and goes flying then stops when it lands, and then blows up and keeps going?
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!
Kirby
Mossy
*
Posts: 1502


Too Long Away

nrmario@hotmail.com
View Profile WWW
« Reply #98 on: January 22, 2010, 08:50:46 PM »

You mean the little bumpy stuff that forms on top of the blocks?(in each level's folder under Block ending with the suffix "top") Or the actual rubble left when they are destroyed? (under the "effects" folder starting with sRubble)
I changed both of them, but the top is still brown. Any idea why?
Logged

I'm learning Japanese!
Add me on Steam! http://steamcommunity.com/id/KirbyLord/
marsgreekgod
Big Bossy
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #99 on: January 22, 2010, 09:02:20 PM »

Um... change backgrounds, there is some stuff there.
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!
Kegluneq
Big Bossy
Mossy
*
Posts: 2260



View Profile Email
« Reply #100 on: January 22, 2010, 09:13:43 PM »

help! my bomb rock doesn't seem to work right. How would one make a rock that blows up when ever it stops, and goes flying then stops when it lands, and then blows up and keeps going?

Code:
if (xVel = 0 and yVel = 0)
    make an explosion

Right?
Logged

A wild SHINY MOSSY appeared!
Arucard
Mossy
*
Posts: 2811


Hey! Is that CANDY?!?!?

Arucard.Tepes
View Profile Email
« Reply #101 on: January 22, 2010, 09:15:16 PM »

You'd probably want some timer in there too though right?
Logged

Oh, they look like monsters to you?

There's a light in the darkness of everybody's life.
marsgreekgod
Big Bossy
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #102 on: January 22, 2010, 09:26:37 PM »

help! my bomb rock doesn't seem to work right. How would one make a rock that blows up when ever it stops, and goes flying then stops when it lands, and then blows up and keeps going?

Code:
if (xVel = 0 and yVel = 0)
    make an explosion

Right?
Thats what I have. makes a flying rock that doesn't go bomb and hurts you which some times can be picked up and some times not. If it can be picked it, it kills you to do so.
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!
MagiMaster
Bulb
*
Posts: 97


View Profile
« Reply #103 on: January 23, 2010, 02:34:24 AM »

It's very likely that the velocity will never be exactly 0, unless you pick the item up, which would force it to be 0. Instead, you should check if the velocity is close to 0.

Try this, though you might have to adjust the cutoff point.
Code:
if(xVel*xvel + yVel*yVel < 0.001)
    ...
Logged
marsgreekgod
Big Bossy
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #104 on: January 23, 2010, 02:45:35 AM »

It's very likely that the velocity will never be exactly 0, unless you pick the item up, which would force it to be 0. Instead, you should check if the velocity is close to 0.

Try this, though you might have to adjust the cutoff point.
Code:
if(xVel*xvel + yVel*yVel < 0.001)
    ...

I would of thought that, but... my velocity check works with arrows just fine! remember the bomb arrows? same check. remember they arrows that destroy themselves in evil death? same check...
I think it's something to do with the rock itself.
(also the velocity well be exactly 0 a lot, when ever they are on the ground, I checked, game maker rarely has such a problem)
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 ... 5 6 [7] 8 9 ... 64
  Print  
 
Jump to: