In game shooting Problem
Author |
Message |
Marko
|
Posted: Sun Jan 17, 2010 3:22 pm Post subject: In game shooting Problem |
|
|
What is it you are trying to achieve?
I want to be able to see the x's
What is the problem you are having?
When I start the game I don't see the x's but when I hold down enter to shoot I see the x's
Describe what you have tried to solve this problem
I have changed the position of the fork's, cls's, delay's but nothing is working
Turing: |
% Variables
var answer : int
var picture : int
var picture2 : int
var x : int := 10
var y : int := 10
var keys : array char of boolean
var shooter : int := 0
var x2, y1 : int
var check : array 1 .. 1 of int
var f : int
var score1 : real
var finished : boolean := false
% Setting the screen
View.Set ("Graphics,nobuttonbar,position:center;center")
% The Enemy System
process enemy
loop
randint (x2, 5, 75)
y1 := 1
loop
locate (y1, x2 )
put "X"
delay (200)
cls
y1 := y1 + 1
exit when y1 = 26
end loop
end loop
end enemy
% The Game
process game
loop
% Moving
Input.KeyDown (keys )
if keys (KEY_LEFT_ARROW) and x > 0 then
x - = 5
elsif keys (KEY_RIGHT_ARROW) and x < maxx then
x + = 5
% Shooting
elsif keys (KEY_ENTER ) then
shooter := 0
for gundis : 1 .. 20
shooter := shooter + 10
drawline (x, y + shooter, x, y + shooter + 6, red)
delay (10)
drawline (x, y + shooter, x, y + shooter + 6, white)
end for
end if
% Drawing the player
Draw.FillOval (x, y, 10, 10, red)
delay (10)
cls
end loop
end game
%Music during the Main Menu
process Music1
loop
Music.PlayFile ("song.mp3")
end loop
end Music1
% The Main Menu
process MainMenu
% Choices
drawfillbox (0, 0, maxx, maxy, blue)
colorback (red)
% Picture
picture := Pic.FileNew ("picture.jpg")
Pic.Draw (picture, 7, 100, picCopy)
locate (2, 1)
put " Asteroid Destroyers"
locate (11, 45)
put " Instructions"
locate (12, 45)
put " Entre Key- To Shoot"
locate (13, 45)
put " Left Arrow - To move to the Left"
locate (14, 45)
put " Right Arrow - To move to the Right"
locate (23, 1)
put " Press 1 - To Exit"
locate (24, 1)
put " Press 2 - To Start"
locate (25, 1)
put " Made By: Marko Dabic"
% User Input
locate (21, 35)
put " Choice: " ..
get answer
% Game
if answer = 2 then
colorback (white)
cls
colorback (white)
fork game
fork enemy
Music.PlayFileStop
% Quit
elsif answer = 1 then
colorback (white)
cls
locate (12, 28)
put " Thank You for Playing"
end if
end MainMenu
fork MainMenu
fork Music1
|
Please specify what version of Turing you are using
4.1.1
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
SNIPERDUDE

|
Posted: Sun Jan 17, 2010 4:06 pm Post subject: RE:In game shooting Problem |
|
|
At first glance I should at least tell you that you should only ever use a process for playing music (and it is still frowned apon even then, but in Turing it seems to be the only choice for music), you should use procedures instead (there is a difference)
|
|
|
|
|
 |
Marko
|
Posted: Sun Jan 17, 2010 6:32 pm Post subject: RE:In game shooting Problem |
|
|
anyone?
|
|
|
|
|
 |
Turing_Gamer

|
Posted: Sun Jan 17, 2010 7:53 pm Post subject: Re: In game shooting Problem |
|
|
Why don't you combine the game procedure and the enemy procedure together.
I don't know. I usually dont make processes for game code. Just for music.
|
|
|
|
|
 |
TheGuardian001
|
Posted: Sun Jan 17, 2010 7:53 pm Post subject: Re: In game shooting Problem |
|
|
Attach the images, we can't run the game without them.
What do you mean by "I want to be able to see the x's"?
Oh, and you really shouldn't use processes. They really will screw your program up to the point where it often won't act like it should.
|
|
|
|
|
 |
Marko
|
Posted: Sun Jan 17, 2010 8:14 pm Post subject: Re: In game shooting Problem |
|
|
I want to see x's means my game has x's falling from the top of the run window and they are suppose to be falling all the time but they dont. Whenever I press the enter button to shoot they appear and when I let go they disappear. So right now I'am trying to fix that meaning I want the x's to be seen all the time but I dont know what I'am doing wrong.
Description: |
|
 Download |
Filename: |
Game.rar |
Filesize: |
3.57 MB |
Downloaded: |
67 Time(s) |
|
|
|
|
|
 |
Turing_Gamer

|
Posted: Sun Jan 17, 2010 9:19 pm Post subject: Re: In game shooting Problem |
|
|
Ya, don't use processes and have your drawing outside if loops and at the top of the regular loop.
Turing: | loop
cls
%Drawing code
View.Update
%If statements
%Changing variables
end loop |
|
|
|
|
|
 |
|
|