Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with simple grpahical program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Kami




PostPosted: Wed Sep 07, 2011 9:06 pm   Post subject: Help with simple grpahical program

What is it you are trying to achieve?
I am trying to create a simple program that would move around a small circle on the screen using the keys WAS and D


What is the problem you are having?
Turing is telling me no errors, and my code looks fine but the program does not work


Describe what you have tried to solve this problem
I looked over my code multiple times, I have tried re-arranging it, and there is not much else.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

Turing:


import GUI
setscreen("graphics:300;125")

var x := 100
var y := 100
var xchange :=0
var ychange :=0
procedure movement
const RADIUS : int := 5

    Draw.Cls
    Draw.Oval ( x, y, RADIUS,RADIUS, black)
    x += x + xchange
    y += x + ychange
end movement

procedure xchangeup
xchange := xchange + 5
movement
end xchangeup

procedure xchangedown
xchange := xchange - 5
movement
end xchangedown

procedure ychangeup
ychange := ychange + 5
movement
end ychangeup

procedure ychangedown
ychange := ychange - 5
movement
end ychangedown


var buttonup :int := GUI.CreateButtonFull (50,100,0,"Up",xchangeup,0,'^W',false)
var buttondown:int := GUI.CreateButtonFull (50,0,0,"Down",xchangedown,0,'^S',false)
var buttonleft :int := GUI.CreateButtonFull (0,50,0,"Left",ychangedown,0,'^A',false)
var buttonright:int := GUI.CreateButtonFull (100,50,0,"Right",ychangeup,0,'^D',false)

movement




Please specify what version of Turing you are using
I believe it is 4.1.1, the latest one that you can get from CompSci

I am very new to turing syntax, but I do have some experience in other programming languages. It would be nice if you cold explain any syntax that I might need for this.
Not really urgent, but I do need an answer please.
Sponsor
Sponsor
Sponsor
sponsor
Aange10




PostPosted: Wed Sep 07, 2011 9:22 pm   Post subject: RE:Help with simple grpahical program

Alright, it looks to me like just some syntax problems. I recommend you go to http://compsci.ca/v3/viewtopic.php?t=114 to learn the syntax. It will teach you everything you need to know about inputting key strokes.

Ironoically, the first bit of info in the tutorial is how to make a red ball move in a circle. So you should find the solution to all your errors there (:


ALSO: I recommend you read the EXTREMELY helpful guide here: http://compsci.ca/v3/viewtopic.php?t=8808
Raknarg




PostPosted: Sat Sep 10, 2011 10:38 am   Post subject: RE:Help with simple grpahical program

You're going about this the wrong way. There's no need for GUIs, only a little thing called Input.KeyDown. Use the first link Aange10 gave you and you'll be fine.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: