Jump to content

How can I make an interruptor ?


Dabu
 Share

Recommended Posts

Hello !

So I'm actually working on an little puzzle platformer game with Phaser 2.6.2 and I'm a bit disoriented right now..

I've searched everywhere and I've got nothing interesting at the moment for this mechanics so I've came here to get some help, here's what I'm trying to do:

I want to create a button that can be interacted with my player by pressing a keyboard touch. This button could lead to open a door for example.

Same thing, I would like to create a box that can be pushed by the player, and when it overlap, or collide whatever, an interruptor, it would open a CERTAIN door in the map.

I know it's seems silly but I cannot find anything like this anywhere else in game examples, in Phaser examples, and on forums.. :/

Could you help me out please ? Thank you :)

EDIT: I forgot to mentionned that I also work with Tiled, I was thinking about using ObjectLayer but heh..

 

Edited by Dabu
forgot to mention a tool..
Link to comment
Share on other sites

Still not clear what you mean by an interrupter.

Are you after how to make the door open (mutating part of your map structure)? Or asking about the collision detection side of things?

Or do you want to 'pause' (or, interrupt) the execution of your game? Kind-of what happens in many games when you open a modal (like an inventory screen in an RPG, for example), or the pause/options screen in many games?

Link to comment
Share on other sites

Hey mattstyles, :)

I will try to be more specific sorry about that :unsure:

Like you said, I want to mutate part of my map structure by pressing a button. But not a button like a pause button, I want to make a button which, when the player sprite is nearby, can be interact and do an event. ( For now, I just want to delete some tiles for example. So modifying the map and show or unshow tiles. )

Thank you for helping me :)

Link to comment
Share on other sites

Since my English is very bad (and I'm really sorry about that !) I will try to give more details about what I need.

What I use:

I'm on Phaser 2.6.2 and using Phaser.Physics.ARCADE with the plugin Phaser.Plugin.ArcadeSlopes.

I use 4 principals States ( Boot.js / Preloader.js / MainMenu.js / LevelProto.js ) and I use Tiled to create my Map.

My game is a platformer / puzzle game (screenshots below could also help you to understand what I need).

What I need:

I need to create an object. When the player.body is near this object AND when he press a button on his keyboard, an event start.

Here I would like that this event cause the door to open or close. ( Like screenshots ).

But I don't know how to: 

Detect when the player is nearby the object ( I suppose with an overlap ? )

Choose a specific object on my map and make it disappear or appear.

Should I make this with an objectLayer on Tiled ?

Screenshot_1.png

Screenshot_2.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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