Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, AndrewAMD), 822 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Continuing c_scan #441595
05/28/14 07:43
05/28/14 07:43
Joined: Mar 2003
Posts: 1,524
Canada
Stansmedia Offline OP
Serious User
Stansmedia  Offline OP
Serious User

Joined: Mar 2003
Posts: 1,524
Canada
Im trying to perform a scan of entities with scan limit and a test if the entities FLAG1 is set. Problem is the scan is executed randomly and if the object being scanned for is within a certain distance (and they are all in pretty short distance most of the time) - I need to ignore that entity and scan for one further. I tried running another scan after the distance returned less then the certain value with ignore you in the second scan but it's just coming up with empty pointer errors.

So basically, I need to run a c_scan that only returns entities that are further then a specified distance. I could have each of the entities being scanned for run their own vec_dist and toggle their enable_scan based on their own distance checked... But that's a lot of functions to be running so that's kind of a poor way out. Any ideas?


Decessus - 80% done. 100% abandoned.
GET MY ANDROID GAME! https://play.google.com/store/apps/details?id=com.lasertrain.zspinballfree&hl=en
Re: Continuing c_scan [Re: Stansmedia] #441596
05/28/14 08:07
05/28/14 08:07
Joined: Jun 2013
Posts: 108
Alberta, Canada
C
CanadianDavid Offline
Member
CanadianDavid  Offline
Member
C

Joined: Jun 2013
Posts: 108
Alberta, Canada
In the entity performing the scanning, perhaps you can simply do one check for distance (using vec_dist) based on the modified 'you' pointer given that c_scan result is greater than zero:

Code:
result = c_scan(...);
if(result>0 && you != NULL){
  var distance = vec_dist(my.x, you.x);
  if(distance > 100) { ... } // do something if further than a distance of 100
}


Re: Continuing c_scan [Re: CanadianDavid] #441628
05/29/14 01:46
05/29/14 01:46
Joined: Mar 2003
Posts: 1,524
Canada
Stansmedia Offline OP
Serious User
Stansmedia  Offline OP
Serious User

Joined: Mar 2003
Posts: 1,524
Canada
I think performing the scan ahead of the play with vec_rotate will be the best way. I went to bed last night and it popped into my head. Which is the worst time because I had to get up early and I really wanted to stay up and keep coding haha.

Something like this:

vec_set(temp.x,vector(64,0,0));
vec_rotate(temp.x,vector(camera.pan,0,0));
vec_add(temp.x,camera.x);
c_scan(temp.x,...);


Decessus - 80% done. 100% abandoned.
GET MY ANDROID GAME! https://play.google.com/store/apps/details?id=com.lasertrain.zspinballfree&hl=en
Re: Continuing c_scan [Re: Stansmedia] #441629
05/29/14 02:31
05/29/14 02:31
Joined: Jun 2013
Posts: 108
Alberta, Canada
C
CanadianDavid Offline
Member
CanadianDavid  Offline
Member
C

Joined: Jun 2013
Posts: 108
Alberta, Canada
If you're absolutely sure you won't need a c_scan surrounding the player then that sounds like it could work too!

Re: Continuing c_scan [Re: CanadianDavid] #441631
05/29/14 03:13
05/29/14 03:13
Joined: Mar 2003
Posts: 1,524
Canada
Stansmedia Offline OP
Serious User
Stansmedia  Offline OP
Serious User

Joined: Mar 2003
Posts: 1,524
Canada
I'll give a random y position to scan with, should turn out alright. laugh


Decessus - 80% done. 100% abandoned.
GET MY ANDROID GAME! https://play.google.com/store/apps/details?id=com.lasertrain.zspinballfree&hl=en

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1