Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #17  
Old 06-14-2014, 06:52 PM
blackbeltben blackbeltben is offline
Registered User
Join Date: Aug 2011
Posts: 83
blackbeltben is on a distinguished road
Blocking NPCs

I have my tiles working correctly thanks to you two

on Created:
PHP Code:
function isBlocking(tile) {
  
temp.blocktiles = {0,16,1024,1025,1026,1027,1028,1029};
  return (
tile in temp.blocktiles);

And the check:
PHP Code:
 if (!isBlocking(tiles[player.x+1.5,player.y+3])){
   
player.+= 1;
  } 
So if the player is not touching the blocking tiles, the player will fall
(for platformer system)


Now I want to go advanced and make collision with certain NPCs..

So I was wondering if someone could help me write this.


The NPC
PHP Code:
function onCreated(){
 
this.blocking true;
 
setShape(13232);
 
setImg("block.png");


The on Created:
PHP Code:
function isBlocking(tile) {
  
temp.blocktiles = {0,16,1024,1025,1026,1027,1028,1029};
  return (
tile in temp.blocktiles);
  
temp.blocknpc //Check if the temp.npc.blocking == true


The check:
PHP Code:
 if (!isBlocking(tiles[player.x+1.5,player.y+3])){
  if 
/*not colliding with npc that is blocking*/ {
   
player.+= 1;
  }
 } 
Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:15 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.