Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 925245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:29:24+00:00 2026-05-15T19:29:24+00:00

// Arg0 – Map, Arg1 – X, Arg2 – Y, Arg3 – Distance, Arg4

  • 0
// Arg0 - Map, Arg1 - X, Arg2 - Y, Arg3 - Distance, Arg4 - MaxDistance  

var xx,yy,dist, x1, y1, dir, maxdist, obj, res, map;  
map = argument0  
x1 = argument1  
y1 = argument2  
dir = argument3  
maxdist = argument4  
dist = 0

do {  
    dist+=1  
    xx = x1+round(lengthdir_x(dist,dir))  
    yy = y1+round(lengthdir_y(dist,dir))  
} until(block_isSolid(map_get_block(map,xx,yy)) or dist>maxdist)  

if !block_isSolid(map_get_block(map,xx,yy)) {  
    return false  
} else {  
    res = ds_list_create()  
    ds_list_add(res,xx)  
    ds_list_add(res,yy)  
    return res  
}

There’s the function. lengthdir_x/y is sin/cos(dir)*dist.
Don’t yell at me for putting the C tag on there. The languages are very very similar, to the point where I could almost copy this straight in.

Right, formalities done:
This current algorithm will sometimes go diagonally (Where both x and y change by one in either sign), but I wish it not to do this.

EG:
Current: (Where X is the ray casted)

xoooo  
oxooo  
ooxoo  
oooxo  
oooox  

Wanted:

xxooo  
oxxoo  
ooxxo  
oooxx  
oooox  

Make sense?

Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:29:25+00:00Added an answer on May 15, 2026 at 7:29 pm

    delta is a float and is the x-distance of an virtual secound “ray”(should be around 1.0f – 2.0f, just experimentate)

    Delta should not be less than the size of a single pixel in the map.

    do {  
        dist+=1  
        xx = x1+round(lengthdir_x(dist,dir))  
        yy = y1+round(lengthdir_y(dist,dir))  
    } until(block_isSolid(map_get_block(map,xx,yy)) || block_isSolid(map_get_block(map,xx + delta,yy)) or dist>maxdist)  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#define MEMCACHED_COMMAND_GET(arg0, arg1, arg2, arg3, arg4) #define MEMCACHED_COMMAND_GET_ENABLED() (0) The macros above seems totally
onItemClickListener has following arguments onItemClick(AdapterView arg0, View arg1,int arg2, long arg3) I am getting
auto generated method argument names looks like arg0, arg1, arg2 is there any way
Hy! My Code: public void onItemClick(final AdapterView<?> arg0, View arg1, final int arg2, long
Basically, I have: public abstract class AbstractClass { public AbstractClass( Type arg0, Type arg1,
Here's my code: myButton.setOnClickListener( new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1)
@Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); setContentView(R.layout.map); MapView mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true);
I am using onTouch(View arg0, MotionEvent arg1) as a game input. It returns false
I'm trying to make this code generic: public final Object unwrap(Class arg0) { throw
I can add a Conditional statement to a breakpoint, for instance arg0.startsWith(something) but i'd

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.