Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • solarus solarus
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 229
    • Issues 229
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 10
    • Merge requests 10
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Solarus Games
  • solarussolarus
  • Issues
  • #150
Closed
Open
Created Apr 28, 2013 by Christopho@christophoOwner

Feature Request : get_direction4_to_entity / get_direction8_to_entity

Created by: Renkineko

It could be very useful to get the good direction to look for a NPC / enemy without redeclaring this function every time...

From the code of Agahnim, for direction4 (no need to open the file, I'm too kind... Hehe) :

function enemy:get_direction4_to_hero()

local hero = self:get_map():get_entity("hero") local angle = self:get_angle(hero) local direction4 = (angle + (math.pi / 4)) * 2 / math.pi return (math.floor(direction4) + 4) % 4 end

The second function could be optional, with the direction4 we can (I think) get easily the direction8.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking