How to make slice no longer visible?

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
sheamkennedy
Liquid Metal Slime
Posts: 1110
Joined: Mon Sep 16, 2013 9:29 pm
Location: Tama-shi, Tokyo, Japan
Contact:

How to make slice no longer visible?

Post by sheamkennedy »

EDIT: Nevermind, my script was working properly I just mistakenly placed the initialize script in the auto-run code's while loop which resulted in a weird outcome.

I am trying to make a step-on script in which the hero steps on an NPC and this makes an "action icon" show up on the screen which indicates to the player that they can carry out the action by pushing the action button on their keyboard.

So far I have a script which displays a HUD in the auto-run loop of my code:

Code: Select all

script, initializeHeroHUD, begin 
   # Call this script once, at the start of your game
   FullHUD := load small enemy sprite(0)
   
   #ITEMS:
     actionGrind := load small enemy sprite(1)
   
   #Place the sprites on the screen
     #HUDS:
     put sprite(FullHUD, 260, 160)
     
     #ITEMS:
     put sprite(actionGrind, 260, 160)   
     
     updateHeroHUD
 end

script, updateHeroHUD, begin  
  if(grind1 == true) then(
    set slice visible(actionGrind, true)
  ) else if(grind2 == true) then(
    set slice visible(actionGrind, true)
  ) else (
    set slice visible(actionGrind, false)
  )

end
I am having no problem displaying the "action icon" when the hero steps on the NPC. The issue is that I can't seem to make the "action icon" no longer visible once I perform the action or move to a new tile where the action is no longer available. Is my script not stating that "set slice visible(actionGrind, false)" if all the action variables are currently false?
Last edited by sheamkennedy on Tue Sep 06, 2016 9:35 pm, edited 1 time in total.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
Post Reply