How do I make a sprite randomly spawn in different location?

Get help using Construct 2

Post » Thu May 25, 2017 6:20 am

this is what i got, but it still respawn in the same location.

System:Every 2.0 second
System:Pick Random Instance ( Spawn ) --> System: Create object (Sprite 4) on layer 0 (Spawn.X , Spawn.Y)
B
5
S
1
Posts: 11
Reputation: 349

Post » Thu May 25, 2017 6:56 am

How are you setting Spawn.X and Spawn.Y?

You can add a condition after or before the object is created that says something like;

Set Spawn.X to random(value)
Set Spawn.Y to random(value)

This should change the Spawn variables and make the spawn position change each time.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499

Post » Thu May 25, 2017 7:04 am

SoldjahBoy wrote:How are you setting Spawn.X and Spawn.Y?

You can add a condition after or before the object is created that says something like;

Set Spawn.X to random(value)
Set Spawn.Y to random(value)

This should change the Spawn variables and make the spawn position change each time.

~Sol


I've cloned my spawn sprite. how make it random?
B
5
S
1
Posts: 11
Reputation: 349

Post » Thu May 25, 2017 7:16 am

you set its position to x = random (0,100)
and its y position to =random(0,100)
B
87
S
44
G
16
Posts: 1,009
Reputation: 17,946

Post » Thu May 25, 2017 8:49 am

justifun wrote:you set its position to x = random (0,100)
and its y position to =random(0,100)


thanks all for your replies =)

Is there a possibility to use 8 directions without using arrow keys? i mean the sprite wont be controlled by the player
B
5
S
1
Posts: 11
Reputation: 349

Post » Thu May 25, 2017 11:11 am

On the 8-direction movement set default controls to no, after that you can change them in the event system. But implementing AI with 8-direction is bad idea, use the pathfinding behavior instead.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367


Return to How do I....?

Who is online

Users browsing this forum: Cryttexx, Yahoo [Bot] and 20 guests