Script Calls from Conditional Branches - AND OR / Boolean statements

prodigium24

Warper
Member
Joined
Mar 2, 2016
Messages
1
Reaction score
0
First Language
English
Primarily Uses
Hi there


I'm trying to create a script call to determine if two gameMap.events overlap running from a Conditional Branch IF statement.


So far I've got the following working correctly:


Math.abs($gameMap.event(001).x - $gameMap.event(002).x) + Math.abs($gameMap.event(001).y - $gameMap.event(002).y) == 1












My issue is that I want to introduce OR statements into the equation to account for instances where several different events might land interact with event 001. So far I have:


Math.abs($gameMap.event(001).x - $gameMap.event(002).x) + Math.abs($gameMap.event(001).y - $gameMap.event(002).y) == 1 || Math.abs($gameMap.event(001).x - $gameMap.event(003).x) + Math.abs($gameMap.event(001).y - $gameMap.event(003).y) == 1 || Math.abs($gameMap.event(001).x - $gameMap.event(004).x) + Math.abs($gameMap.event(001).y - $gameMap.event(004).y) == 1


I've tried a number of different variations on the code after searching around pretty extensively for answers, but I'm very new to Javascript and so far I'm coming up with nada. I feel like my problem is lying in the way I've used my OR (||) statements as the first event on event scenario (001 on 002) will still trigger the desired response, just none of the following ones.


I would be monumentally thankful for any assistance at this point. 


Kind regards and thank you in advance.


Prod
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,078
Members
137,580
Latest member
Snavi
Top