Re: Trying to create a door I can open and close with the GDE.

Its the game development enviroment for the Sonus, Charles.

On the door object, something like this in the button held events will stop the player object from going through them

if "L" "State" "==" "C" "Closed"
if "Col" "Player" "==" "L" ""
subz "1"
endif
endif

Line 1 checks the door has a local varaible set to Closed.
Line 2 checks it is colliding with the player object
if both of these conditions are met, line 3 knocks the player back by 1, this example is if the up button is being pressed so it knocks the Z co-ordiante down by one.


Next on the doorknob object that changes the state of the door. The following code applies

setlv "StateHasChanged" "false"
if "Col" "Player" "==" "L" ""
if "L" "State" "==" "C" "Closed" "Door"
setlv "State" "Open" "Door"
setlv "StateHasChanged" "true"
endif
if "L" "State" "==" "C" "Open" "Door"
if "L" "StateHasChanged" "!=" "C" "true"
setlv "State" "Closed" "Door"
endif
endif
endif

Line 1 sets the "State Has Changed" variable to false, so false is the defult state everytime the event is run.
Line 2 checks the door knob is colliding with the player
Line 3 CHecks the local variable "State" on the door is set to Closed
If both of these are true. Line 4 then sets the door "State" variable to Open and then Line 5 sets the "State Has Changed" varaible to true. I use this variable to stop the next part of the code firing, as the next section checks that it is false.
Line 6 closes the condition section checking if the if the door is closed.
Line 7 then checks if the local variable called "State" is set to Open on the door
Line 8 then checks if the "State Has Changed" variable is not set to True (essentially checking if we have just changed the State to Open, if this wasnt here the door would set itself to open and then straight back to closed again.)7
Line 9 then sets the Door State to Closed
Line 10, 11 and 12 then close the remaing open conditions including the Player collision condtion than all actions except line 1 are in.

I havent tested the code but its pretty simple so hopefully it should work. Sorry I havent had as much spare time at the moment to help you out.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Sean-Terry01 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Charles via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Charles via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Aaronlp via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Aaronlp via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Charles via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Sean-Terry01 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Sean-Terry01 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Sean-Terry01 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Sean-Terry01 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Aaronlp via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Sean-Terry01 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Sean-Terry01 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Aaronlp via Audiogames-reflector

Reply via email to