SPAWNED SPRITES ARE DRAWN INCORRECTLY

Get help using Construct 2

Post » Fri Nov 15, 2013 5:37 am

i have a quick question:
i have a sprite (a cloud) that is perfectly smooth on the edges (both in the drawing program, and when imported as a sprite into C2 as PNG-8). when the original sprite is placed on the screen, it's still smooth (no problem so far), but when i spawn copies of the cloud sprite...the copies are all jagged edged and blurry. i'm using version r150 dont know if that helps).


can you please help and let me know why the original is smooth in and out of C2; but the spawned copies look like crap?

thanks a million, in advance.
B
141
S
44
G
10
Posts: 135
Reputation: 14,103

Post » Fri Nov 15, 2013 5:41 am

Could you be spawning more then one sprite at a time?
B
62
S
20
G
56
Posts: 1,077
Reputation: 36,021

Post » Fri Nov 15, 2013 5:43 am

yes, i spawned several copies of the cloud at different x/y locations. all spawned copies have jagged edges (they are all the same size as the original; just drawn like crap)..yet the original sprite on the screen looks great.

help please
B
141
S
44
G
10
Posts: 135
Reputation: 14,103

Post » Fri Nov 15, 2013 5:58 am

Do you have a capx to look at?Burvey2013-11-15 06:08:40
B
62
S
20
G
56
Posts: 1,077
Reputation: 36,021

Post » Sat Nov 16, 2013 3:25 am

Burvey...thanks for all your help, but after 2 days of working on this i stumbled by accident on the solution..i still dont know why it works, but it does (if you can explain it to me, please do).

if i call either "Create object" or "spawn object" from an event that compares vales (x=y...current level=5...etc) then the spawned sprites have jagged edges...but if i call the same "Create object" or "spawn object" from a time-related event (eg "compare time") then the spawned sprites are as smooth as the original...flawless. why the time-event makes a difference i dont know. is there a better solution, i dont know. i would love to post the capx, but dont know how to do that either. hope this helps, and saves someone else days of wasted development time and frustration. now back to the cool stuff i hope i can do with C2.
B
141
S
44
G
10
Posts: 135
Reputation: 14,103

Post » Sat Nov 16, 2013 3:28 am

I think Burvey meant you may be spawning them constantly on the same location so they would appear blurry as its loads of clouds overlapping? Maybe the time event works as expected and only spawns the one cloud but the variable comparison is always true so it keeps spawning them. Cannot tell without looking at the events really : D
B
47
S
18
G
84
Posts: 2,273
Reputation: 49,800

Post » Sat Nov 16, 2013 3:36 am

damn dude....that's it !!!!
after reading your post plinkie, i went back and changed the time interval to make it happen super quickly (to replicate the "variable comparison is always true so it keeps spawning them" theory) and it produced the same jagged result. you're 100% right. so let me ask you this: if i want to test something (variable comparison) and spawn (but not continously, as you've pointed out)...whats the best way to do that? how can i toggle that functionality on/off to prevent endless spawing?
B
141
S
44
G
10
Posts: 135
Reputation: 14,103

Post » Sat Nov 16, 2013 3:44 am

You can use global variables to set true/false when something has been spawned. Just make sure the condition for spawning is limited. If you need something specific I need to know what event you currently have for spawning an object i.e. what has to be true for the object to be created?
B
47
S
18
G
84
Posts: 2,273
Reputation: 49,800

Post » Sat Nov 16, 2013 3:48 am

i tried your approach with a varialbe i called "new level". so if "new level" = true; then spawn clouds, etc. if variable<>true, the function does not get called. last question, i promise: i dont want to creat too much system demand. so i check for the variable with "system - every 0.5 seconds". is that ok, or is that totally retarded and there's a better/optimal way of doing this?
B
141
S
44
G
10
Posts: 135
Reputation: 14,103

Post » Sat Nov 16, 2013 3:52 am

Are you just trying to spawn clouds at the start of the level? If so, then you can just use OnStartOfLayout action and there's no need for variables.

For system demand it's fine because all events are run every tick anyway. You can use EveryTick or Every X seconds, I think either is fine although EveryTick could be better suited for some reason.
B
47
S
18
G
84
Posts: 2,273
Reputation: 49,800

Next

Return to How do I....?

Who is online

Users browsing this forum: ounound and 24 guests