How do I find whats the random coordinates that system

Get help using Construct 2

Post » Wed Apr 27, 2016 11:25 pm

Random coordinates that system creates sprites.
I just want to know the coordinates where sprites is createn randomly by system.
B
5
S
2
Posts: 11
Reputation: 439

Post » Wed Apr 27, 2016 11:44 pm

you can try setting up a textbox object and then do every tick - set textbox to sprite.X & "," & sprite.Y

That would make your texbox to look like 46,46 on the screen if the sprite x position is at 46 and the y position is at 46

Although you could just as easily go into debugger menu and pause and then click on the object in the left and there is a property you can look at its X,Y.

Why would you need to know how to find out a newly created object's X/Y position ?
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Thu Apr 28, 2016 12:26 am

Gearworkdragon wrote:you can try setting up a textbox object and then do every tick - set textbox to sprite.X & "," & sprite.Y

That would make your texbox to look like 46,46 on the screen if the sprite x position is at 46 and the y position is at 46

Although you could just as easily go into debugger menu and pause and then click on the object in the left and there is a property you can look at its X,Y.

Why would you need to know how to find out a newly created object's X/Y position ?



I want to figure it out. I mean, how is C2's brain working like ?
How is C2 gives random coordinates.
B
5
S
2
Posts: 11
Reputation: 439

Post » Thu Apr 28, 2016 1:21 am

Here a good article on it http://www.howtogeek.com/183051/htg-exp ... m-numbers/

it isnt a C2 issue its a all and every electronic computer module uses it.

But yes it is confusing just dont ask how it does it. just be glad that you can use the function. And as far as random coor its usually determine by your layout size such as this the min coor are 0,0 and the max coor is what ever your layout size and know this if you dont put a clamp on the number like int or floor or round it just gonna do 1.8888888888888888888888888888888 in a number so in other word in coor you will never get a negative number. its alway postive.

but as far as how does a computer get random result...just call it magic lol
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Fri Apr 29, 2016 4:04 pm

Use random() and then in the event just write the coordinates to an array at X and Y. Then you can access those coordinates by Array.get(1,1) .get(2,2) etc.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,414
Reputation: 4,822


Return to How do I....?

Who is online

Users browsing this forum: digitalsoapbox, RetrocadeMedia and 1 guest