View Single Post
  #13  
Old 02-27-2015, 06:46 AM
Elk Elk is offline
Sr Marketing Strategist
Elk's Avatar
Join Date: Nov 2005
Location: Deerland
Posts: 3,829
Elk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant future
Send a message via ICQ to Elk Send a message via AIM to Elk Send a message via MSN to Elk Send a message via Yahoo to Elk
Quote:
Originally Posted by cbk1994 View Post
(If you could, you'd probably want to use || instead of && by De Morgan's laws. Unless I'm misinterpreting what you're trying to do.)
|| = or
&& = and

player.x != player.y 8-D

Ok now I tried this, but it isnt fading in nor fading out, just permanently onscreen

PHP Code:
//#CLIENTSIDE
function onCreated(){
  
dontblock();
  
layer 2;
  
temp.fimg findimg(375);
  
fimg.screenwidth 2;
  
fimg.screenheight 180;
  
fimg.text "Era Underground Complex Level 2";
  
fimg.layer 8;
  
fimg.zoom 2;
  
fimg.style "bc";
  
fimg.textshadow true;
  
fimg.shadowcolor = {0,0,0};
}
function 
onTimeOut() {
  
checkArea();
  
setTimer(0.05);
}
function 
checkArea() {
  if (
player.x in |this.x-10,this.x+10| && player.y in |this.y-5,this.y+5|) {
    if (!
this.showed) { // If the image hasn't been displayed since their last entrance
      
this.showed true// Flag it as displayed
      
onFadeIn(); // Start fading in
    
}
  } else {
    if (
this.showed) { // If it was displayed already
      
this.showed false// Unset it, since they're no longer inside
    
}
  }
}
function 
onFadeIn() {
  if (
player.x in |this.x-10,this.x+10| && player.y in |this.y-5,this.y+5|) {
    
this.img.alpha += 0.05// 0.05 is a placeholder, it will take num * 20 seconds to fully fade in, so @ 0.05 it will take 1 second
    
if (this.img.alpha 1) { // If it isn't fully visible yet
      
scheduleEvent(0.05temp.namenil); // THIS 0.05 is not a placeholder, it is the tick rate of graal - this will "loop" the fade in
    
} else {
      
onPause(3); // '3' is up to you, it's how long it will appear to "hang," this creates the "pausing"
    
}
  } else {
    
onFadeOut(); // If the player left the area, stop fading in and start fading out instead
  
}
}
function 
onPause(timeLeft) {
  if (
player.x in |this.x-10,this.x+10| && player.y in |this.y-5,this.y+5|) {
    if (
timeLeft 0) {
      
scheduleEvent(0.05temp.nametimeLeft 0.05); // Keep counting down if the player is inside and there's time left to pause.
    
} else {
      
onFadeOut(); // Once time runs out, fade out
    
}
  } else {
    
onFadeOut(); // If player isn't still in area, pre-maturely fade out.
  
}
}
function 
onFadeOut() {
  if (!(
player.x in |this.x-10,this.x+10| && player.y in |this.y-5,this.y+5|)) {
    
this.img.alpha -= 0.05// Lower the alpha back down, remember: this 0.05 is a placeholder
    
if (this.img.alpha 0) { // While it's not 0 yet
      
scheduleEvent(0.05temp.namenil); // Keep looping to decrease it
    
}
  } 
// No need to put an else {} here to check if they re-enter the area. If they re-enter the area, this will fail and onFadeIn() will be called by checkArea()

__________________
iEra IGN: *Elk (Darkshire)
iCla. IGN: *Elk (Darkshire)
iZone IGN: *Elk (Darkshire)




Reply With Quote