Jump to content

A Creeping Death, Fading, light effects, etc


TheScruffyGuy
 Share

Recommended Posts

I am trying to add a element to my game where the player has two objects two deal with

1) Health meter depletes over time and must be filled by collecting refills (Done)

2) The Creeping death of fear itself..

The creeping death is, well fear. As you play the game, the screen is fading to black around the player and the player needs to collect "hope" to combat this fear but I am not sure the best way to go about it.

I thought of making the screen fade with a overlay that darkens over time but then I found a post about lighting in devlogs. I thought cool I can attach a light source on the player  and have it fade that way it is always center on the player. The problem with that is I can't open the examples for some reason nothing loads. I will keep trying to open them. My question is, is there another way to do this that I am not thinking about? Is this something that Phaser 3 can do?

 

Here is the feel I am going for. This is not the finished character and its a 2d platformish style game. So he will be facing left and right.

TheLittleRobotpng.png

Link to comment
Share on other sites

Hey there,

I do not know if the lighting stuff is implemented in the current phaser version; I am a bit out of date on the updates.
But what you can do is this: https://gamemechanicexplorer.com/#raycasting-3

You can write your own "shadowsystem". But this may take a hit on performance. So if you are doing an pixelart game it would be fine, for higher graphics styles like vector and stuff.. it may be too intense.

regards

Link to comment
Share on other sites

Thanks @SamTheMightyI am definitely look into raycasting as a layer to some level ideas that I have, but its not really what I am looking for  so far the best I have come up with is Camera Fade in and out but I am not sure how to implement this into the code seeing as this is the first time I have worked with cameras.

so this is what I tried...

//Hope
            hope = this.physics.add.staticGroup({key: 'hope', immovable: true});
            hope.create(200, 500, 'hope');
            this.physics.add.overlap(player, hope, collectHope);
            hKey = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE);
            //Fear
            this.cameras.main.fadeOut(6000, useHope);
            
        }

//Hope Mechanic
function collectHope(player, score)
{
    hope.killAndHide(score);
    score.body.enable = false;
    currentHope = Phaser.Math.MaxAdd(currentHope, 100, maxHope);
    
}

//Use Hope
function useHope()
{
    
    if(hKey.isDown, currentHope === 0)
    {
        currentHope.Remove(100);
        this.cameras.main.fadeIn(6000);
    }
}

function fearDeath()
{
    if (currentHope === 0);
    {
        player.body.reset(100, 450);
        htext.setText('Hope: TOO AFRAID!')
    }
}

this is what I am working on so far some of the stuff isn't right I have been just trying to get it to work some way some how at this point I can't even get the hKey to work..

Anyways that is what I got and I am trying to accomplish.. I still have a lot og doc searching to do so far I haven't found any tutorials on any of this. lol Wish me luck!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...