How do I translate function

Get help using Construct 2

Post » Wed Apr 22, 2015 5:28 am

this is a math problem more less..

now i have a boat - it has 6 weapon levels.
level 1 - shoot forward
level 2 - shoot forward and left at the same time
level 3 - shoot forward left and right at the same time
level 4 - shoot forward different bullets
level 5 - shoot forward and left different bullets
level 6 - forward left and right different bullets.

now i'm tryin' to optimize this code as much as i can and i've already reduced code from 6 subevents to 3,
but i can't figure how to translate weapon level (1,2,3,4,5,6) to number of bullets (1,2,3,1,2,3). any ideas?

also how would i use the 1,2,3,1,2,3 for shooting in angles (1 - forward, 2 - forward and left, 3 - forward left and right)?
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
42
S
14
G
12
Posts: 624
Reputation: 9,421

Post » Wed Apr 22, 2015 5:49 am

variable: numberofbullets = 1;2;3;1;2;3

set currentnumberofbullets to: int(tokenat(numberofbullets, weaponlevel-1, ";"))
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786


Return to How do I....?

Who is online

Users browsing this forum: grigrizljac, korbaach and 18 guests