How to load Armour/Weapons smoothly & easily?

Get help using Construct 2

Post » Wed Feb 19, 2014 9:35 pm

Hi, i'm currently developing an RPG game that is based on skills, and training your stats up to get better weapons but I have managed to encounter an issue in which after 3 days of pondering and testing I have not been able to find a solution for.
I wish to ask how would I go about creating a single weapon into the layout that the player has equipped/bought and I only want 1 weapon to be loaded onto the layout at a time because I don't want a lot of memory in the graphics processor taken up by unused entities/sprites.

I wish to make the game work something like this:
On start of layout: System.CreatePlayer(x, y) then System.CreateWeapon(x, y) then System.CreateArmour(x, y) BUT the issue is how would I make the system only create the specific weapon without having to have all the weapons and armour loaded into the game at one time?

It would be great if anyone who has surpassed this issue before could quickly post a response on how to fix this soon :)
B
6
S
2
Posts: 19
Reputation: 547

Post » Wed Feb 19, 2014 11:05 pm

<bump> Anyone? </bump>
B
6
S
2
Posts: 19
Reputation: 547

Post » Wed Feb 19, 2014 11:12 pm

Give it some time mate , bumping after 1 hour of waiting won't help much ;
And moreso , Don't worry , there's plenty of mem' out there , just don't use high-res textures too much
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,471

Post » Wed Feb 19, 2014 11:31 pm

If you absolutely want to have only 1 weapon loaded in the layout, I don't see other technique but a layout per weapon, and dynamic loading of everything else, as you can't create an object in a layout in C2 if it wasn't created at the start of the layout.
In that case, I would still use the same layout for multiple weapons that have the same animations, as you may be able to spare a little more memory here too.

That being said, you sure can put more than 1 weapon in a layout. Plus, if you destroy it at the start, depending on the device, the memory will be free automatically (I may be mistaking, if anyone has more precise info).
B
17
S
8
G
4
Posts: 473
Reputation: 6,211

Post » Wed Feb 19, 2014 11:56 pm

Guizmus wrote:If you absolutely want to have only 1 weapon loaded in the layout, I don't see other technique but a layout per weapon, and dynamic loading of everything else, as you can't create an object in a layout in C2 if it wasn't created at the start of the layout.
In that case, I would still use the same layout for multiple weapons that have the same animations, as you may be able to spare a little more memory here too.

That being said, you sure can put more than 1 weapon in a layout. Plus, if you destroy it at the start, depending on the device, the memory will be free automatically (I may be mistaking, if anyone has more precise info).

So you are telling me if I place every piece of weapon and armour into the layout but when the layout is officially loaded when previewing the game I can run a line saying something like:
OnStartOfLayout - *armour.destroy() and *weapon.destroy()
?

Now if that is possible(I will test later) will I be able to do something like this?
(While in shop)
Player.BuySword2
Sword1.Unpin, Sword1.destroy, Player.createSword2(x,y), Sword2.Pin(Player, x, y) ? or with any other sword and armour?
B
6
S
2
Posts: 19
Reputation: 547


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests