How do i make it do this?

0 favourites
  • 13 posts
  • First thing first, I'm working on 2 games at once, which is why there are 2 topics by me and unlike my over game this one has a much simpler concept. This game is for a small college assignment.

    (Skip to the bottom part if you just want to know the question and can't be bothered with the concept)

    The question i have is of a cosmetic nature and wont affect the game play if i cant get it working.

    So that you can get an idea of the game, the player is on an abandoned ship trying to get the flight recorder, there is no power on the ship and most of the doors are sealed, either by debris or they're locked. It's a top down game, meaning the player has a birds eye view of the map.

    As the theme is on an abandoned ship i have created a sprite that has a slight transparency on the outer edges and nothing in the center and then pinned it to the player, this makes it look like the player has a torch on his suit.

    Now onto the question, is there a way i could make it so the player can only see into the rooms when they have opened the door?

  • You could use the new shadowing system. See the following capx.

    [attachment=0:w6xrzxjx][/attachment:w6xrzxjx]

    An other way could be to use black sprites above each room and lower their opacity every time the doors that lead to each room are opened.

  • i had tried the idea with the sprites but i had all the doors as the same object and it caused more head aches, the other thing though, that boat.capx has done the trick, mostly anyway.

    The only issue i have now is that one of my sprites turns completely black when i add the shadow caster behavior to it, i could probably fix this by adding an invisible sprite pinned to it.

    Anyway thank you for the help eli0s, this isn't the first time you've helped me and knowing my luck it wont be the last

  • No problem

    About that sprite that turns completely black, try to pull it up in the z-order (right click/z-order/send to top). If you don't want to be covered by the shadows, it has to be above the the light object.

  • The ordering worked, although i had originally done my idea, which served the same purpose albeit in a round about way, until i lost an hour and a half worth of work on sprites and some of the game itself due to a power cut.

    I got the game back to roughly the same place and some of the sprites but now i have an issue with the walls, the player can see through the walls when they're close to them, do you know if this is due to the walls being too thin or the player model clipping slightly?

  • I am not sure I understand what you mean. Can you post the capx..? A simplified version will do.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • i cant upload the capx, ive stripped pretty much everything from the game that is decorative, shrunk the layout sizes, shrunk and reduced the amount of sprites in the current area and it STILL wont go below 3.78 MB, the max upload limit is 2MB.

    I'll try to explain it as best i can:

    In terms of the effect im using on the player, it is identical to the boat.capx effect that you linked me, all the coding is the same.

    The wall has only solid and shadow caster behaviors on them, the player has scroll to, 8 direction and bind to layout behaviors, while the doors have Solid and Shadowcaster too. everything apart from the player bound to layout is identical in terms of behaviour. as for the code itself, it is also the same as the boat game as it had worked at first

    as for the game itself, the player can see through the shadow cast by the walls when they're close to said wall, this makes it so that the player can see through the wall. As well as being able to see through the wall, the player can see the doors through the shadows as well, although it is like that on the boat game and i could incorporate that into my game if needed.

    If i haven't explained it well let me know and i'll try again eli0s

  • I can't interpret this "the player can see through the shadow cast by the walls when they're close to said wall". You mean that when you come edge on with a wall, that particular wall stops emitting shadows?

    If yes, perhaps you are using a light radius that is too big? The light radius should be half the size than the diameter of the smaller shadow caster object. In practice, if you have a wall that it has 128px width and 8px height, the light radius shouldn't be more than 4, since 8 is the smaller dimension and the radius has to be <= of that dimension.

    As for the next part, for the time being, there isn't a way to have a shadow casting object be both above the shadows and below the shadows, depending from if it's being shadowed by an other object or not.

  • After taking a break and getting a coffee (i hate having to pull all nighters for coursework) and then re reading your post about the height difference, i think i have found the issue.

    I had it set up before so that i had stretched the same wall sprite to varying lengths to make it easier on walling off every room, i think the issue i had for the player seeing through the wall was because it couldn't cast a shadow over every part of the wall.

    Now using the boat as an example i tried creating a repeatable pattern to use for my walls and then leaving the dimensions the same throughout and now the room is properly blocked by shadow, although i have only tried a single room so far though.

    I'll let you know how it goes

  • Yeah, coffee does help sometimes

    The dynamic shadowing plugin is in its infancy right now. v.170 was the first time ever having such a system. I think that it will improve and expanded upon in the future, so building your gameplay and level design around its current state might cause you problems later on.

    There are other ways around your darkening rooms mechanic, a simple one is the following -that of course can be improved using variables and UIDs to link each room with a certain doors etc.

    [attachment=0:1nistk12][/attachment:1nistk12]

    I suggest try and develop some other mechanics of your game first, give the lighting/shadowing system some time to develop and come back to it later on, when it has proven more useful/reliable.

    Anyway, good luck, if you need anything don't be shy

  • I'm back again eli0s

    i have gotten all the shadows and cosmetics of the game done and i'm now trying to create the objectives that the player has to do and then AI paths for 2 NPCs and the enemy and then i'm finally done

    For the friendly NPC paths (they wont have any combat, they only walk along with you in the mission to a certain point and then end up dead/MIA) would i create their paths using the path finding ability or the custom movement, which one do you think would better serve the purpose.

    As for the enemy NPC they will be on a patrol path so i'd use path finding for that i think.

  • Welcome back

    I don't have any serious experience with AI, so all I can tell you is based on examples I've seen and on speculation.

    If your game is strictly "grid" based, meaning that all the corridors/rooms/walls/doors are divided into segments, you might just make it with custom movement/events. You could make the player spawn an invisible sprite every x grid spaces and make the friendly NPCs move to the last known location in steps.

    But I think that using the path finding behavior will save you a lot of headaches. Just figure out a system that makes sense, make them move/stop when appropriate. I think that the most challenging part won't be the movement, but picking which target should they choose to go/attack to.

  • i was thinking that the path finding would be easier to do, i'll give it a go, i have 6 hours or so until my deadline so i should have time to learn it.

    Thanks again eli0s

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)