Specify a range of values
#1
Posted 22 July 2011 - 12:41 AM
Specifically, the width of the object - from it's very left pixel to it's very right.
The object's coordinates start from the very top left as usual.
Can you help me? Have explained the question correctly?
Many thanks.
#2
Posted 22 July 2011 - 12:48 AM
for (p=0; p<WIDTH; p+=1) {
if (!position_empty(x+p, y)) {
/* This position is not empty */
}
}Or perhaps you'd rather use the collision_line() function instead of position_empty()?
-IMP
#3
Posted 22 July 2011 - 12:52 AM
You'd have to use a loop:
for (p=0; p<WIDTH; p+=1) { if (!position_empty(x+p, y)) { /* This position is not empty */ } }
Or perhaps you'd rather use the collision_line() function instead of position_empty()?
-IMP![]()
A loop, huh? I hadn't thought of that. I'll have a go with the for loop.
I've not used collision_line() before. I'm not sure how it works. Could you provide a brief description?
Edited by _174413, 22 July 2011 - 12:52 AM.
#4
Posted 22 July 2011 - 12:55 AM
collision_line(x1,y1,x2,y2,obj,prec,notme) This function tests whether there is a collision between the line segment from (x1,y1) to (x2,y2) and entities of object obj. This is a powerful function. You can e.g. use it to test whether an instance can see another instance by checking whether the line segment between them intersects a wall.
So you can supply the keyword all as the object to check for.
-IMP
#5
Posted 22 July 2011 - 12:58 AM
I can copy and paste from the Help File, sure:
collision_line(x1,y1,x2,y2,obj,prec,notme) This function tests whether there is a collision between the line segment from (x1,y1) to (x2,y2) and entities of object obj. This is a powerful function. You can e.g. use it to test whether an instance can see another instance by checking whether the line segment between them intersects a wall.
So you can supply the keyword all as the object to check for.
-IMP![]()
Many thanks. I feel a bit guilty now that you've looked that up. I could've done it. I must look really lazy!
Anyway, I'll be alright now, so cheers for your help!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











