
-----------------------------------
nick4563
Tue Jan 18, 2011 8:11 pm

Castle Defender -Boxy the Boxinator
-----------------------------------
Attached below is my first game in Turing, let me know how it is...  :P

-----------------------------------
TerranceN
Tue Jan 18, 2011 8:27 pm

Re: Castle Defender -Boxy the Boxinator
-----------------------------------
Pretty good for a first game in Turing, you seem to have all the fundamentals down. Unfortunately, there is not much challenge to the game, as all the enemies come from the very bottom, and holding down 1 makes a javelin last forever. Also, from looking at your code, you would benefit a lot from using arrays, records, and procedures that use a parameter to handle things on any enemy you pass to it.

Also, it's spelled Boxxy

-----------------------------------
Tony
Tue Jan 18, 2011 8:31 pm

RE:Castle Defender -Boxy the Boxinator
-----------------------------------
Can't actually run it, but I'll take a look at the code:

arrays! Check them out, it will allow you to easily code games with many items/enemies/etc. Also inlining value initializations (var enemy:boolean := false) will make the entire thing look less like a wall of text.

[code]
View.Set ("offscreenonly") % makes the flashing graphics static
[/code]
That's not what offscreenonly does.

[code]
drawline * many
[/code]
If you have a static background, you  could just load an image with [tdoc]Pic.FileNew[/tdoc]

Or move that chunk of code into a procedure, so that you can have a more understandable loop.

[code]
loop
  ...
  Input.KeyDown (chars)
  ...
  Input.KeyDown (chars)
[/code]
Multiple KeyDown in the same loop are redundant.

Your mixture of tabs and spaces disturbs me and makes reading of your code weird.

[code]
   enemy :=true
    
   %Enemy1
    if enemy = true
	then enemy_x1 -= 9
	enemy_x2 -= 9
	drawfillbox (enemy_x1, enemy_y1, enemy_x2, enemy_y2, brightred)
	delay (10)
    else
...
[/code]
Do you see how the "else" part will _never_ happen? Also, it's a bad idea to have delays anywhere before View.Update. See my comment above on "offscreenonly"

[code]
    if Castle_HP < 0
	then 
	colourback(red)
	Draw.FillBox(0,0,639,399,black)
	locate(20,30)
	put "GAME OVER"
    end if
[/code]
I'm pretty sure that the game is still going on in the background, it's just being drawn over.

-----------------------------------
nick4563
Tue Jan 18, 2011 8:42 pm

RE:Castle Defender -Boxy the Boxinator
-----------------------------------
Thank you for the advice i will  make sure to use this for my next game... what does "off-screen-only" do? I took out the else that was a mistake from an earlier version, I took it out of enemy 2 and 3 but forgot 1 I guess... and yes the game still is going on in the back ground but nobody knows that unless they look at the code...

-----------------------------------
nick4563
Tue Jan 18, 2011 8:49 pm

RE:Castle Defender -Boxy the Boxinator
-----------------------------------
Also how would I make multiple javelins that can be thrown while the other one is on the screen and that cant be held (last forever)??

-----------------------------------
Tony
Tue Jan 18, 2011 8:52 pm

RE:Castle Defender -Boxy the Boxinator
-----------------------------------
offscreenonly does http://en.wikipedia.org/wiki/Multiple_buffering#Double_buffering_in_computer_graphics

edit: the answer is probably "array"s.

-----------------------------------
nick4563
Tue Jan 18, 2011 9:00 pm

RE:Castle Defender -Boxy the Boxinator
-----------------------------------
Thank you, Tony! I have a feeling I am going to be saying that a lot to you :p

-----------------------------------
Tony
Tue Jan 18, 2011 9:07 pm

RE:Castle Defender -Boxy the Boxinator
-----------------------------------
Hah. If you write some great code and help around here, that'd be cool ;)

-----------------------------------
nick4563
Wed Jan 19, 2011 4:48 pm

RE:Castle Defender -Boxy the Boxinator
-----------------------------------
Ill help when i can but I'm pretty new and am self taught... I can do easy stuff no prob though.

-----------------------------------
nick4563
Sun Sep 11, 2011 7:12 pm

RE:Castle Defender -Boxy the Boxinator
-----------------------------------
Im revisiting my old game after quite some time and trying to improve it... I am redoing the scenery and the way the player looks and moves. I am not sure how to have the player shoot more than one bulet at a time... im guessing it has to do with arrays but im rusty and cannot figure it out even after a fair amount of research.

-----------------------------------
Aange10
Mon Sep 12, 2011 8:13 pm

RE:Castle Defender -Boxy the Boxinator
-----------------------------------
Don't worry, nick. They help you plenty. Good luck on your game! And also, Array are confusing me too!(: ... It's not really the array, just the usage of it. An array is just a bunch of variables in one line/one name.


var my_array : array 1 .. 10 of int

So all that is make a variable (var), names it (my_array) and defines it (:) as an array (array) from 1 through 10 (1 .. 10) of integeres (of int)

Reading the turing walkthroughs will help you a ton, and there are some great people here who will help you... Sadly this is as much as I can do for you as I'm not sure how to put arrays into practice. (Like using a for loop with multiple arrays).

Anyways, good luck! And this is the turing walkthrough...

-----------------------------------
nick4563
Tue Sep 13, 2011 4:09 pm

RE:Castle Defender -Boxy the Boxinator
-----------------------------------
Thank you I  think I have narrowed it don to flexible arrays using a record but im still lost after that... And I have been through the turing walkthrough before... Because I know that is what people are going to say. If somebody could give me an example relevant to my needs that would be very helpful. I am not asking you to write my buleet programming i just need a basis to understand how it works
