skip navigation
Game Plague Forums
Not a member? ( Register )
User Name: Password:
Item question
Pages: [1] -
Pazaza
10/20/12 06:52 pmFilter

Dualer


Awards:

Group: Member
Posts: 210
How would one program an item while while you were using it. Enemies passed right through you and you passed through enemies. But you couldn't pass through walls. All this in a Zelda like game?

------------
WHAAAAA....!!???!
Iasper
10/20/12 07:50 pmFilter - Reply #1

Dual Master


Awards:

Group: Member
Posts: 1099
...your post is awfully vague and not understandable. Could you try rewriting your question and going a bit more into detail?

------------
Pazaza
10/20/12 09:49 pmFilter - Reply #2

Group: Member
What's vague about it? Ok, I'll ask it a different way. Let's say your playing Zelda. And there was an item that let you pass through enemies and enemies pass through you. What is a code or way using gamemaker to do that?
Iasper
10/21/12 06:14 amFilter - Reply #3

Group: Member
Well, first of all set a variable to see if the item is in use or not, then check the variable when you check collision with enemies.
Pazaza
10/22/12 09:18 amFilter - Reply #4

Group: Member
Then what?
Iasper
10/22/12 10:15 pmFilter - Reply #5

Group: Member
So for example add in the code for the collision event with walls for the player following code: x=xprevious; y=yprevious; This will prevent the player from moving into walls. For moving objects such as enemies a more complicated code is required but let's assume enemies don't move either, give them following code: if (global.itemused==false) { x=xprevious; y=yprevious: } This will make you bump into enemies as well if global.itemused is false. Whenever you want to activate the item, set global.itemused to 1.
Pazaza
10/24/12 11:44 am - Last edited 10/24/12 11:46 am by PazazaFilter - Reply #6

Group: Member
And then make it so the collision doesn't happen when the item is used? I'm guessing if the global thing is equal to 1, then collision false? Some enemies in this game will charge at you in narrow corridors or block pathways to other rooms, so this item is needed to beat the game, thank you
Iasper
10/24/12 12:47 pmFilter - Reply #7

Group: Member
When global.itemused equals 1, you can freely pass through enemies but not through walls.
Pazaza
10/24/12 01:13 pmFilter - Reply #8

Group: Member
More often enemies will be passing through you. Charging in fact. And thank you
Pages: [1] -