How do I Minimap keep Spawning objects

Get help using Construct 2

Post » Thu Dec 01, 2016 7:09 am

hi guys!

I was following a tutorial on minimap. One thing I notice after debugging, the line of code which use FOR EACH, it keeps spawning the objects, causing the fps to drop! please if anyone can give me some idea how to fix this?

reference link
https://www.scirra.com/tutorials/834/basic-mini-map
B
22
S
6
G
1
Posts: 11
Reputation: 1,772

Post » Thu Dec 01, 2016 11:17 am

Image
B
108
S
24
G
18
Posts: 1,372
Reputation: 22,817

Post » Sat Dec 03, 2016 4:31 am

thanks for the reply! I tried this one! its not calculating the object position correctly and i think its more like radar where the player is always in the center! my player is not in the center!

what i am using at the moment is

For Each "obj_flags" system>create minimap_flags on layer HUD at hud_minimap.X+obj_flags.X*hud_minimap.Width/LayoutWidth
hud_minimap.Y+obj_flags.Y*hud_minimap.Width/LayoutWidth

But i don't know why For Each is creating objects every frame! it should create only 1 object on mini map for each instance right? and If I move the line of code under "On Start of Layout" it create only once which I want! but the problem with this is! if I hit any flag on the level! it will destroy all the instances on the mini map!
B
22
S
6
G
1
Posts: 11
Reputation: 1,772

Post » Sat Dec 03, 2016 1:15 pm

Okay, I'll work on a sample file for you and later I post here =]

-------------
@qaisarehman
100% working
https://dl.dropboxusercontent.com/u/47035927/Samples/Map.capx
Image
B
108
S
24
G
18
Posts: 1,372
Reputation: 22,817

Post » Mon Dec 05, 2016 5:05 am

TELLES0808 wrote:Okay, I'll work on a sample file for you and later I post here =]
-------------
@qaisarehman
100% working
https://dl.dropboxusercontent.com/u/470 ... s/Map.capx


Amazing! it worked :D Big thanks man! :) took me a while to figure how its working! my code of causing problem! but I figured out in the end!

thanks again for the help!! :)
B
22
S
6
G
1
Posts: 11
Reputation: 1,772


Return to How do I....?

Who is online

Users browsing this forum: JackTYGA, maranpis, oosyrag and 20 guests