Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / [SOLVED] Stuck with FOR and two-dimensional array..

Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 30th Jul 2020 13:37
Hi guys, maybe for the summer hot temperature or too many years without programming but I have a problem; I think a little problem but I stuck.

I have a two-dimensional array:
dim objects_hit(100,10)

I have another array too:
dim index(100)

I have 100 character object (obj numbers from 300 to 400)
I have a single object as visual wave too (obj numb 200)

This "objects_hit" array represents 100 characters in the first field and 10 visible objects in the second field.
The "index" array represent the index of visible objects (max 10 objects) for all the 100 character objects.

In my code ONLY THE SECOND character (obj number 1, only him) will shot the visual wave ; when this visual wave will hit another character so
I need to fill "objects_hit" array with the right character number in the right index!.

ok I tried this:

So I get a lot of kaos inside my "objects_hit" array.. and the index seems to go over the cicle with strange values too..
Thank you all in advance!

The author of this post has marked a post as an answer.

Go to answer

Kevin Picone
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 1st Aug 2020 13:01 Edited at: 1st Aug 2020 13:10
This post has been marked by the post author as the answer.
I don't really follow what your trying to achieve here, but If the for / loop is meant is stop when Index(1) is equal to 10, then you'll need to Exit for the For / Next Loop when that condition is met.


I would assume you wanted to do something more like this though.

PlayBASIC To HTML5/WEB - Convert PlayBASIC To Machine Code
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 2nd Aug 2020 09:11
Thank you SO MUTCH Kevin! You solved it!

Login to post a reply

Server time is: 2020-08-04 04:25:45
Your offset time is: 2020-08-04 04:25:45