BattleShips(Minions) help
Author |
Message |
yumrum
|
Posted: Fri Jan 08, 2010 4:12 pm Post subject: BattleShips(Minions) help |
|
|
What is it you are trying to achieve?
So I started working on this new game because i finished my soccer one
it's called battleships but it's not like a tradition one it's like the game minions on kongregate
What is the problem you are having?
i want to know if turing can create variables mid game like during the game it creates and names things like x1 x,2 and so on so that more people can be created
also i tried to work on scrolling but i'm not really sure where to start with that |
|
|
|
|
|
Sponsor Sponsor
|
|
|
TheGuardian001
|
Posted: Fri Jan 08, 2010 5:29 pm Post subject: Re: BattleShips(Minions) help |
|
|
This can be done using flexible arrays, which work like normal arrays, however their length can be changed dynamically.
Turing: |
%create the flexible array
var x : flexible array 1 .. 1 of int
x (1) := 2
%add a new element to the array
new x, upper(x ) + 1
%array bounds are now 1 .. 2
x (2) := x (1)
put x (2)
%delete the top element from the array.
new x, upper(x )- 1
%array bounds are now 1 .. 1 again
|
When adding or removing elements, you can also use an actual number in place of upper(x), and the array will be resized to match that value.
Documentation for flexible arrays can be found here: flexible |
|
|
|
|
|
yumrum
|
Posted: Sun Jan 10, 2010 6:11 pm Post subject: RE:BattleShips(Minions) help |
|
|
sweet thanks thats really helpful |
|
|
|
|
|
|
|