Creating weapons selection during the game

Get help using Construct 2

Post » Fri Jan 24, 2014 9:45 am

Hi guys
i am a beginner and new using this software, and wondering is there any basic tutorials about creating a weapons selection during the game and can use it directly. it will very helpful if you guys can help me with the basic start to do this. thank you :)
B
5
Posts: 10
Reputation: 277

Post » Fri Jan 24, 2014 2:40 pm

Hi Rapid Motion
The basic concepts are set out in the Tutorial section of this site.

It will greatly help your process if you get familiar with the Manual and the tutorials...practice simple stuff until you get the idea
Like any system that you design in games development,
A weapon system could become quite complex if you take into consideration all of the factors you may desire to implement in your game...

Weapon Design and selection would depend on your game style,
but the basic premise is the same for most games



First of all you would need to figure out what weapons you intend to have and create or gather all of the required visual elements to display on the screen or in the layout if necessary

These could be anything from sprite objects with separate weapon animation frames or separate weapon animation of each weapon loaded into the WEAPON object to simple TEXT driven data fields or particles only that display onscreen when required..its totally up to your style of game design.

There are so many ways to go about it ..You could use a series of sprites with separate images that you either spawn at location of PLAYER and destroy as required on Keypress events or by using a mouse wheel or any other input you can imagine..the basic premise is the same for all input devices

Once you have the visual elements in place
Including all of the Bullet elements or FX that you wish to see..

Then you could begin to code the Events for the Weapon select..
If you dont have weapons to select from yet..making a weapons selector is kindof pointless as you might want to expand it later and have to redesign your whole system from scratch

IMHO its always, ALWAYS better to work it all out on paper before you write any CODE or script Events

This way for each project you can see exactly what you are going to do before you actually go about creating the Assets or lines of code for a system..

(& Keep a reference of what your weapon names will be in the EVENT SHEETS)

The basic idea is to Create a Global TEXT Variable called "Weapon_Selected" or simliar

and set the initial value to "None"

This helps you keep track of data and make help you quickly determine which weapon is visible at any particular time...
once again it depends on your game design...you may not need this..


For keyboard weapon select using the 1-0 keys(thats 10 weapons!!!)

Create a new event in your event sheet ..
Condition

On Keyboard keypress = 1

Action
-> system
-> set GLOBAL VARIABLE "WEAPON_SELECT" to ( your weapon name eg pistol!!)
-> SET WEAPON.ANIMATION-(WEAPON PISTOL)
or whatever system you decided to go with ..The ACTION for it would go here


Second Condition

On Keyboard keypress = 2

Action
-> system
-> set GLOBAL VARIABLE "WEAPON_SELECT" to ( your second weapon name eg Spudgun!!)

etc etc

until you have all of your weapons correctly laid out



then after all of those declarative Events

a new Event that Reads

for mouse wheel driven selection you would create a Global NUMBER variable that adjusts its value in relation to mouse scrolling which then links to a table of events

for example

ON MOUSE WHEEL UP...-> SYSTEM ADD TO GLOBAL VARIABLE "WEAPON_SELECT" 1

ON MOUSE WHEEL DOWN...-> SYSTEM SUBTRACT FROM GLOBAL VARIABLE "WEAPON_SELECT" 1

THEN A TABLE OF EVENTS LIKE SO

WEAPON_SELECT = 1
-> SET WEAPON ANIMATION TO "PISTOL"

WEAPON_SELECT = 2
-> SET WEAPON ANIMATION TO "SPUDGUN"

ETC ETC


There are many ways to do it..but its really up to you which system works best...for your game..
There is a basic Tutorial on this
of course each weapon would most likely need its own unique bullet sprites and sound fx and variables to appear different..
ie..incendiary bullets would look and do more damage than normal bullets and a flame thrower needs an entirely different approach to design..etc

Try this Simple Tutorial for more info
https://www.scirra.com/.../how-do-you-change-weapons-a-lesson-for- beginners

But yes if you are just starting out ..I really cant emphasise enough that you need to be familiar with the manual and the basic TUTORIALS before attempting anything else...otherwise it may be a little confusing..mystazsea2014-01-24 15:03:36
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
35
S
13
G
8
Posts: 318
Reputation: 7,685

Post » Mon Jan 27, 2014 8:07 am

Hi my stazsea

Thank you for you reply. yes i agree with you am still learning the manual now try to understand the basics first. basically the game that i want to create is when during the weapons selection using a mouse or touch when u choose your weapons will be directly using the weapons and following cursor of the mouse when you left click or touch will start shooting.but i will test your way first the simple one to understand the concept first. btw the link you gave me i think is broken "
https://www.scirra.com/.../how-do-you-change-weapons-a-lesson-for- beginners " thank you again for your feedback and info's cheers.
B
5
Posts: 10
Reputation: 277

Post » Mon Jan 27, 2014 10:40 am

https://www.scirra.com/tutorials/584/how-do-you-change-weapons-a-lesson-for-beginners

Thanks for the knowledge and one hearty lol
B
7
S
2
Posts: 12
Reputation: 583


Return to How do I....?

Who is online

Users browsing this forum: evillair, Google [Bot], NumberOne and 5 guests