Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Display Mode
Distance Sensitive Button
FindAll
CPS Audio/MIDI Xtra
Pan QTVR Sprite
Trigonometry Class v0.6
LipSync
MP3 player and project source code
FrameReady()
Attr
MediaMacros Xtras Mall
 

 

 

Behavior Basic 4 direction environment navigation

Added on 6/17/1999

 

Compatibilities:
behavior D7 D8 Mac PC

This item has not yet been rated

Author: MediaMacros (website)

This will provide basic navigation of a Myst-like environment. To generate the markers for each grid location check out the Build Environment script.

--Copyright 1999 Chuck Neal
--chuck@mediamacros.com
--If you find this code helpful, send me an e-mail and let me know.  :-)

property whichHotSpot, spriteNum

global maxX, maxY

on getPropertyDescriptionList me
  p_list = [:]
  addProp p_list, #whichHotSpot, [#format : #symbol, #comment : "What navigation hotspot:", #default: #ahead, #range : [#ahead, #turnleft, #turnright, #back]]
  return p_list
end

on mouseUp me
  --get the current marker
  currentLoc = findLastLabel()
  --set the delimiter to brak the location by
  the itemDelimiter = "-"
  currentX = integer(currentLoc.item[1])
  currentY = integer(currentLoc.item[2])
  currentD = integer(currentLoc.item[3])
  newLocList = [currentX, currentY, currentD]
  case whichHotSpot of `
    #ahead:
      --go foward 1 based upon the current direction
      case currentD of
        1:
          --Facing North
          newLocList[2] = (currentY - 1)
          if newLocList[2] < 1 then newLocList[2] = 1
        2:
          --Facing East
          newLocList[1] = (currentX + 1)
          if newLocList[1] > maxX then newLocList[1] = maxX  
        3:
          --Facing South
          newLocList[2] = (currentY + 1)
          if newLocList[2] > maxY then newLocList[2] = maxY
        4:
          --Facing West
          newLocList[1] = (currentX - 1)
          if newLocList[1] < 1 then newLocList[1] = 1
      end case
    #turnLeft:
      newLocList[3] = currentD - 1
      if newLocList[3] < 1 then newLocList[3] = 4
    #turnRight:
      newLocList[3] = currentD + 1
      if newLocList[3] > 4 then newLocList[3] = 1
    #back:
      case currentD of
        1:
          --Facing North
          newLocList[2] = (currentY + 1)
          if newLocList[2] > maxY then newLocList[2] = maxY
        2:
          --Facing East
          newLocList[1] = (currentX + 1)
          if newLocList[1] < 1 then newLocList[1] = 1  
        3:
          --Facing South
          newLocList[2] = (currentY + 1)
          if newLocList[2] < 1 then newLocList[2] = 1
        4:
          --Facing West
          newLocList[1] = (currentX - 1)
          if newLocList[1] > maxX then newLocList[1] = maxX
      end case
  end case
  goTo = string(newLocList[1]) & "-" & string(newLocList[2]) & "-" & string(newLocList[3])
  if marker(goTo) <> 0 then
    go goTo
  end if  
end

on getBehaviorDescription me
  describe = "This behavior can be dropped on hot-spots to navigate a 3d/Myst like environment.  Use the Build Environment Script to generate the markers for the environment, then set the maxX and maxY values as globals."
  return describe
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail