 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
Bomberman9000 You are the n00b

Joined: 21 Mar 2003 Posts: 3 Location: New Zealand
|
Posted: Thu Sep 25, 2003 3:46 am Post subject: Bomberman Style game |
|
|
Hi people.
I've been working on a bomberman style game for a while but I can' t get the script to work. When i plant a bomb, the bomb explodes like it should but the explosion appears in the top left corner. I'll put the script here.
Quote: | #---------------------------------------------------------------
Include, bomberman.hsi
Include, Scancode.hsi
Include, Plotscr.hsd
#---------------------------------------------------------------
#Scripts
Define Script (1,bombing,none)
#---------------------------------------------------------------
Script, Bombing, begin
If (key is pressed(key:m))
Then (Begin)
Variable (Bomb)
Bomb:=NPC Reference(0) #NPC reference for the bomb.
X:= NPC X (bomb)
Y:= NPC Y (bomb)
Variable (X)
Variable (Y)
Create NPC (Bomb, Hero X, Hero Y, Down) #Place the bomb
set NPC direction (Bomb,down)
wait (10)
set NPC direction (Bomb,left)
wait (10)
set NPC direction (Bomb,up)
wait (10)
set NPC direction (Bomb,right)
wait (10)
destroy NPC (Bomb)
wait (1)
Create NPC (1,X + 1, Y, down) #Bomb Explodes
Create NPC (1,X -- 1, Y, down)
Create NPC (1,X, Y + 1, down)
Create NPC (1,X, Y -- 1, down)
wait (1)
Create NPC (1,X + 2, Y, down)
Create NPC (1,X -- 2, Y, down)
Create NPC (1,X, Y + 2, down)
Create NPC (1,X, Y -- 2, down)
wait (1)
Create NPC (1,X + 3, Y, down)
Create NPC (1,X -- 3, Y, down)
Create NPC (1,X, Y + 3, down)
Create NPC (1,X, Y -- 3, down)
wait (3)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
)
end
end
#--------------------------------------------------------------- |
Can anyone see where i went wrong? _________________ Simon James |
|
Back to top |
|
 |
Minnek Conjurer

Joined: 03 Jun 2003 Posts: 430 Location: Somewhere
|
Posted: Thu Sep 25, 2003 4:45 am Post subject: |
|
|
I think I've got this one. You're assigning your X and Y variables before you have placed the bomb in the right location. Also, you may want to declare the variables THEN do the assignments.
Quote: |
#---------------------------------------------------------------
Include, bomberman.hsi
Include, Scancode.hsi
Include, Plotscr.hsd
#---------------------------------------------------------------
#Scripts
Define Script (1,bombing,none)
#---------------------------------------------------------------
Script, Bombing, begin
If (key is pressed(key:m))
Then (Begin)
Variable (Bomb)
Bomb:=NPC Reference(0) #NPC reference for the bomb.
Variable (X)
Variable (Y)
Create NPC (Bomb, Hero X, Hero Y, Down) #Place the bomb
Wait (1) # Just in case
X:= NPC X (bomb) # I moved the two variable assignments down here.
Y:= NPC Y (bomb)
set NPC direction (Bomb,down)
wait (10)
set NPC direction (Bomb,left)
wait (10)
set NPC direction (Bomb,up)
wait (10)
set NPC direction (Bomb,right)
wait (10)
destroy NPC (Bomb)
wait (1)
Create NPC (1,X + 1, Y, down) #Bomb Explodes
Create NPC (1,X -- 1, Y, down)
Create NPC (1,X, Y + 1, down)
Create NPC (1,X, Y -- 1, down)
wait (1)
Create NPC (1,X + 2, Y, down)
Create NPC (1,X -- 2, Y, down)
Create NPC (1,X, Y + 2, down)
Create NPC (1,X, Y -- 2, down)
wait (1)
Create NPC (1,X + 3, Y, down)
Create NPC (1,X -- 3, Y, down)
Create NPC (1,X, Y + 3, down)
Create NPC (1,X, Y -- 3, down)
wait (3)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
destroy NPC (1)
)
end
end
#---------------------------------------------------------------
|
This should work. (I added some comments in there so you could see what I was doing, if it wasn't already apparent.) Let me know if it does or doesn't and I'll try to help some more if possible  _________________ * SDHawk has joined #Minnek
SDHawk> AAAAAAAAAAAAAUUUUUUUUUGH
* SDHawk has left #Minnek (Leaving) |
|
Back to top |
|
 |
Bomberman9000 You are the n00b

Joined: 21 Mar 2003 Posts: 3 Location: New Zealand
|
Posted: Fri Sep 26, 2003 3:55 am Post subject: |
|
|
Thanks man, you're the legend _________________ Simon James |
|
Back to top |
|
 |
Flamer The last guy on earth...

Joined: 04 Feb 2003 Posts: 725 Location: New Zealand (newly discovered)
|
Posted: Mon Sep 29, 2003 10:28 am Post subject: |
|
|
just saying this as a comment, that's a lot of destroy NPCs _________________ If we were a pack of dogs, IM would be a grand Hound, CN would be a very ficious little pitball, and Giz...well, it doesn't matter breed he is, he'd still be a bitch
(no offense to anyone that was mentioned) |
|
Back to top |
|
 |
Minnek Conjurer

Joined: 03 Jun 2003 Posts: 430 Location: Somewhere
|
Posted: Mon Sep 29, 2003 9:16 pm Post subject: |
|
|
I like destroying NPCS  _________________ * SDHawk has joined #Minnek
SDHawk> AAAAAAAAAAAAAUUUUUUUUUGH
* SDHawk has left #Minnek (Leaving) |
|
Back to top |
|
 |
Setu_Firestorm Music Composer

Joined: 26 Mar 2003 Posts: 2566 Location: Holiday. FL
|
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|