Author Topic: Level design/ Code questions from a beginner  (Read 16049 times)

0 Members and 1 Guest are viewing this topic.

InTouch

  • Achiever
  • Seedling
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
Re: Level design/ Code questions from a beginner
« Reply #195 on: August 02, 2010, 01:51:54 AM »
i tried making a test map using euclid but it throws an error saying:
Unable to load level
Resources/Maps/test.lua:117:'end'
expected (to close function at line 99)
near'<eof>'
 ??? ???

w4tc

  • Achiever
  • Shrub
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 170
Re: Level design/ Code questions from a beginner
« Reply #196 on: August 02, 2010, 01:57:55 AM »
can you have you code?

Terrial

  • Sapling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 66
Re: Level design/ Code questions from a beginner
« Reply #197 on: August 02, 2010, 10:04:15 AM »
I got the level to work.  It wasn't recognizing when the timer = the game time  I fixed it by making it <=

So I'm putting together the asteroids now.  I should have the level up later today.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Level design/ Code questions from a beginner
« Reply #198 on: August 04, 2010, 06:51:14 PM »
W4tc,

I have finally got around to reading your post properly, and building a response.

These changes should provide the functionality you described:



You'll need to make an array for this.
So you need to initialise the array first, you do that in function LevelSetup() using this command:


Code: [Select]
seednumber = {}


All the array slots start out with the value nil.  We want them to start with the value 0.  So initialise the needed slots like this:


Code: [Select]
for seedset = 1,33 do
seednumber[seedset] = 0
end




Finally, make sure you have set the initial background colour:

Code: [Select]
SetBackdropColour(255,127,39)



Next, put this code into function LevelLogic, replacing any existing while loops.




Code: [Select]

while GameRunning() do

for i = 1,4 do
if GetAsteroid(i):GetNumSeedlings(1) > seednumber[i] then
SetBackdropColour(0,255,0)
end
seednumber[i] = GetAsteroid(i):GetNumSeedlings(1)
end


for i = 5,7 do
if GetAsteroid(i):GetNumSeedlings(1) > seednumber[i] then
SetBackdropColour(155,0,0)
end
seednumber[i] = GetAsteroid(i):GetNumSeedlings(1)
end


for i = 8,14 do
if GetAsteroid(i):GetNumSeedlings(1) > seednumber[i] then
SetBackdropColour(0,0,0)
end
seednumber[i] = GetAsteroid(i):GetNumSeedlings(1)
end


for i = 15,33 do
if GetAsteroid(i):GetNumSeedlings(1) > seednumber[i] then
SetBackdropColour(0,0,255)
end
seednumber[i] = GetAsteroid(i):GetNumSeedlings(1)
end



coroutine.yield()
end



annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Level design/ Code questions from a beginner
« Reply #199 on: August 04, 2010, 07:05:48 PM »
RE King of the hill win condition.


I'm interpreting your requirements to mean the following, if this is not right, please say so:


Asteroid 0 will be the King of the Hill asteroid.

There will be two timers, they are called playertimer and aitimer.

playertimer ticks up for the player (empire 1) for every second they own the asteroid.
aitimer ticks up for the enemy (empire 2) for every second they own the asteroid.
If neither empire 1 or empire 2 own asteroid 0, no timer will tick up.

If playertimer reaches 180 sec, empire 1 (the player) wins, and the game ends.
If aitimer reaches 180 sec, empire 1 (the player) loses, and the game ends.



Is this correct?  Let me know if it is, and I'll show you how to make a win condition like this.  :>

w4tc

  • Achiever
  • Shrub
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 170
Re: Level design/ Code questions from a beginner
« Reply #200 on: August 04, 2010, 08:50:27 PM »
OYEAAA
that is working =D

but :$ i may only change when you it send
now it also change with if there a born seed is
So there must be a way that that can block

Also :$ i have 2 questions :

how can I that Owner 2 or IA should not be moving with his seeds to ohtere roid
i want it only send a seed of owner 1 or with commend like return to fluffy ( your level ) with that waves ect :o

and i tried to make me defent and dysontree to level up but it dont works? :s
here is an example

(click to show/hide)

InTouch

  • Achiever
  • Seedling
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
Re: Level design/ Code questions from a beginner
« Reply #201 on: August 04, 2010, 11:23:52 PM »
Quote from: annikk.exe link=topic=774.msg6072#msg6072 date=
RE King of the hill win condition.


I'm interpreting your requirements to mean the following, if this is not right, please say so:


Asteroid 0 will be the King of the Hill asteroid.

There will be two timers, they are called playertimer and aitimer.

playertimer ticks up for the player (empire 1) for every second they own the asteroid.
aitimer ticks up for the enemy (empire 2) for every second they own the asteroid.
If neither empire 1 or empire 2 own asteroid 0, no timer will tick up.

If playertimer reaches 180 sec, empire 1 (the player) wins, and the game ends.
If aitimer reaches 180 sec, empire 1 (the player) loses, and the game ends.



Is this correct?  Let me know if it is, and I'll show you how to make a win condition like this.  :>



Actually terrial has found the right code for me and we are currently working on a map using it.
I sent you a pm requesting your help with something

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Level design/ Code questions from a beginner
« Reply #202 on: August 04, 2010, 11:35:36 PM »
Replied.  Best of luck if you decide to go ahead without me, or thanks for your patience if not.  :>

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Level design/ Code questions from a beginner
« Reply #203 on: August 05, 2010, 12:08:43 AM »
OYEAAA
that is working =D

but :$ i may only change when you it send
now it also change with if there a born seed is
So there must be a way that that can block



Ok, try this code instead:


Code: [Select]
while GameRunning() do

for i = 1,4 do
if GetAsteroid(i):GetNumSeedlings(1) > seednumber[i] and GetAsteroid(i):GetNumTrees() == 0 then
SetBackdropColour(0,255,0)
end
seednumber[i] = GetAsteroid(i):GetNumSeedlings(1)
end


for i = 5,7 do
if GetAsteroid(i):GetNumSeedlings(1) > seednumber[i] and GetAsteroid(i):GetNumTrees() == 0 then
SetBackdropColour(155,0,0)
end
seednumber[i] = GetAsteroid(i):GetNumSeedlings(1)
end


for i = 8,14 do
if GetAsteroid(i):GetNumSeedlings(1) > seednumber[i] and GetAsteroid(i):GetNumTrees() == 0 then
SetBackdropColour(0,0,0)
end
seednumber[i] = GetAsteroid(i):GetNumSeedlings(1)
end


for i = 15,33 do
if GetAsteroid(i):GetNumSeedlings(1) > seednumber[i] and GetAsteroid(i):GetNumTrees() == 0 then
SetBackdropColour(0,0,255)
end
seednumber[i] = GetAsteroid(i):GetNumSeedlings(1)
end



coroutine.yield()
end


Not ideal I guess, but hopefully this will do...

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Level design/ Code questions from a beginner
« Reply #204 on: August 05, 2010, 12:12:15 AM »
Quote
how can I that Owner 2 or IA should not be moving with his seeds to ohtere roid

Script it so that when Empire 2 owns the asteroid, its send distance drops to 0.  When Empire 1 owns the asteroid, its send distance goes back to normal.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Level design/ Code questions from a beginner
« Reply #205 on: August 05, 2010, 12:14:54 AM »
Quote
Code: [Select]
s= c:AddDysonTree() -- DysonTree 1


Try this instead:

Code: [Select]
s = c:AddDysonTree() -- DysonTree 1
Dunno if it will make a difference... but maybe.. :>

w4tc

  • Achiever
  • Shrub
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 170
Re: Level design/ Code questions from a beginner
« Reply #206 on: August 15, 2010, 03:01:21 PM »
sorry annikk that code dont work :$
about this : http://www.dyson-game.com/smf/index.php?topic=774.msg6100#msg6100