Construct Limits Forum Home > Construct Classic > Construct Classic Discussion > Help & Support using Construct Classic |
Post Reply
|
Page <12345> |
| Author | |
Post Options
Quote Reply
Posted: 04 May 2012 at 1:13pm |
|
|
Dear Arima,
Dear Silver, Thanks for trying to help... Please give me your e-mails. I suppose you are honest people - I did much as for the game - and I trust you. My characters are warships - they are about 60 now in the game - I have planned 400. And every ship has guns (every gun is a sprite) and some ships have up to 60 guns. Also I am to show the ship figures - ammunition, crew, speed, qn-ty of guns, etc. That gives something about 20 text fields per ship. That's why 1500 bjects. In fact I need much much more - 10000 objects...(((((((( Edited by Dima111 - 04 May 2012 at 1:15pm |
|
![]() |
|
Post Options
Quote Reply
Posted: 04 May 2012 at 5:17pm |
|
|
You seem to not have a grasp on creating multiples of the same Sprite through events. YOu can have a single text object and create "instances" of it and they write completely different texts. Also, I'm gonna assume the ships don't animate, which would make it even easier to just have one sprite and then 400 animation frames within it, the animations having a speed of 0, and then you just change the animation frame per ship (or weapon).
You probably just need to mess around with Construct a lot more to actually learn it. Try smaller projects, or at least prototype experiments. Also, Arima, if you've once had event sheets that take MINUTES to open, I probably have no serious memory leak issues to worry about for quite a long while, haha. Nothing I've opened in Construct has taken me longer than a second or two. |
|
![]() |
|
Post Options
Quote Reply
Posted: 04 May 2012 at 6:37pm |
|
|
Konjak,
That's great - you grant the hope) You are quite right - I am absolutely far of using the same sprite through events. Where could I find the info how to use "instances"? Or could you please post the respective cap? Please - teach! I will rush to optimize the game! |
|
![]() |
|
Post Options
Quote Reply
Posted: 04 May 2012 at 7:13pm |
|
|
As far as I found in the Forum - instances are the pasted (not cloned) copies of one object? And the only difference between them is in properties by animation frames number?
Konjak - you are quite right - the gun sprites are not animated. Edited by Dima111 - 04 May 2012 at 7:16pm |
|
![]() |
|
Post Options
Quote Reply
Posted: 04 May 2012 at 7:30pm |
|
|
In the event sheet editor you can use the System object action Create Object to spawn a second instance of whatever you would like.
You can even configure it with unique values if you add the settings right after the action that makes it (eg: -Create "Sprite" on layer "Objects" at 0, 0 -Sprite: Set color filter to Red -Sprite: Set private variable "Life" to 100 But, if you want to create multiple sprites at once, you need to do it like this: -Create "Sprite" on layer "Objects" at 0, 0 -Sprite: Set color filter to Red -Sprite: Set private variable "Life" to 100 -Create "Sprite" on layer "Objects" at 0, 0 -Sprite: Set color filter to Red -Sprite: Set private variable "Life" to 100 as any settings after the "Create" action will apply only to the newest sprite you made. |
|
|
Jayjay =]
|
|
![]() |
|
Post Options
Quote Reply
Posted: 04 May 2012 at 7:51pm |
|
|
OK! Got you!
And in that case - the special feature, let's say - the name of the ship and the number of the ship gun - I can write in the private variable (after the "Create")? Which event is responsible for the GunSprite creation - the ShipSprite appears on the Screen? In that case what if it is (I mean - the GunSprite) completely destroyed? Everytime the ShipSprite appears on the screen - the GunSprite will ressurect... Or Always - in that case (as far as I can guess) all my 10000 sprites that are not destroyed will be computed? |
|
![]() |
|
Post Options
Quote Reply
Posted: 04 May 2012 at 8:19pm |
|
|
Now my "gun work" algorythm is (the ship name is AAAA)
When AAAAGunSprite1 overlaps Enemy >> When Enemy: Do not Pick closest to AAAA X,Y ---> Enemy private variable "AAAA" set to 0 (means that the Enemy ship is not under the AAAA fire) >>>> Nothing happens >> When Enemy: Pick closest to AAAA X,Y => Enemy private variable "AAAA" set to 1 (means that the Enemy ship is under the AAAA fire) >>>> Every 10 (let suppose AAAAGunSprite1 gun rate) => AAAA "Ammunition" private variable subtract 1 (AAAAGunSprite1 shoots) >>>>>> Random (1 to 100) (let suppose - AAAAGunSprite1 shooting accuracy) /and/ if the Enemy private variable "AAAA" = 1 (the Enemy is under AAAA fire) /and/ if AAAAGunSprite1 overlaps Enemy (the Enemy is in the AAAAGunSprite1 range) /and/ if Enemy is detected(discovered) (overlaps another Sprite - DetectionSprite) /and/ the Enemy is closest to AAAA => the Enemy recieves 1 hit. What will it be in that case for created instances? Edited by Dima111 - 04 May 2012 at 8:32pm |
|
![]() |
|
Post Options
Quote Reply
Posted: 04 May 2012 at 8:23pm |
|
|
Yep, you can configure the object as much as you like with actions after the create action and it will only applied to that instance.
That second set of events should work with all of your instances already I believe. |
|
|
Jayjay =]
|
|
![]() |
|
Post Options
Quote Reply
Posted: 04 May 2012 at 8:46pm |
|
|
Jayjay,
A bit simplier question))) I have 25 destroyers that are alike each other and every destroyer has 1 (suppose) gun. So all 25 guns can be instances of a single GunSprite. Am I right? To differ the 25 instances from each other need I to create for my GunSprite the PV "Ship name" and after "Create" to write in the Instance PV - AAAA, BBBB, CCCC etc? Edited by Dima111 - 04 May 2012 at 8:48pm |
|
![]() |
|
Post Options
Quote Reply
Posted: 04 May 2012 at 11:02pm |
|
Absolutely, you can match them up with a private variable on each (eg: "ShipNumber" on ship and on GunSprite, then have conditions saying "GunSprite: Value "ShipNumber" = Ship.value('ShipNumber')" and then do positioning events) Or you can use containers. Add the GunSprite object into the container of Ship in the object properties (in layout editor), and whenever you create one of the objects its pair will be created too. Plus, any event relating to one Ship object will automatically refer to its specific GunSprite too! Edit: Careful with containers, if you destroy one of the objects in a container their pairs are destroyed too, same with creation. However, each group of objects (Ship and GunSprite) will act separately from other groups. Edited by Jayjay - 04 May 2012 at 11:03pm |
|
|
Jayjay =]
|
|
![]() |
|
Post Reply
|
Page <12345> |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |