0 Replies Latest reply on Nov 7, 2008 5:33 PM by AlanH_RGU

Hi,

I am having real trouble doing a part of a simulation for some uni coursework, and I need some help.
This is the section I am stuck on. I have been looking at it for 48 hours now, and have been close to smashing my mac because I am so frustrated.

quote:

The first line is “*” followed by stageWidth “*”s, that is for example one followed by 55 *s There then follows one line for each line of the stage up to stageHeight (= 40 to start with). Each line consists of * followed by stageWidth (55) underscores, or “_”. When you get to the (x, y) coordinates of the alien, replace the _ by “A”. Similarly print G for gun and B for bullet. Finish off with a final line of * followed by stageWidth (55) *s. Note: if the gun doesn’t fire, the bullet will still be at (0, 0) and wont print out. gun end position = (30, 40) alien end position = (35, 31) bullet end position = (30, 17)

******************************************************** *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_____________________________B_________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *__________________________________A____________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_______________________________________________________ *_____________________________G_________________________
********************************************************

I have x & y positions for a bullet (if one fires in the simulation) stored, and also the alien x & y co-ords.
The gun is fixed in position of x = 30 y = 40.

I need to know, how & if it is possible to trace a line of charachters to the ouput window, then how to change underscores for letters to indicate the gun, alien & bullet positions.

the rest of my code is -