Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Cant seem to make my buttons work

Author
Message
sarusian
8
Years of Service
User Offline
Joined: 3rd Nov 2015
Location:
Posted: 3rd Nov 2015 08:14
Quote: "
// Project: CalculatorPlus
// Created: 2015-11-04

// set window properties
SetWindowTitle( "CalculatorPlus" )
SetWindowSize( 1024, 768, 0 )

// set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )

Global First
Global Second
Global Answer
Global MButton

Global TextNumber

// 1 Button
AddVirtualButton ( 1, 50, 175, 100 )
SetVirtualButtonActive( 1, 1 )
SetVirtualButtonText ( 1, "1" )

// 2 Button
AddVirtualButton ( 2, 150, 175, 100 )
SetVirtualButtonActive ( 2, 1 )
SetVirtualButtonText ( 2, "2" )

If GetButtonPressed ( 1 ) = 1
TextNumber = TextNumber + 1
Endif

If GetButtonPressed ( 2 ) = 1
TextNumber = TextNumber + 2
Endif

do

Print( ScreenFPS() )
Print (TextNumber)
Sync()
loop
"


I Cant Fully understand what I'm doing wrong?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 3rd Nov 2015 11:32
You need to put your DO statement higher up, above the IF statements.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
sarusian
8
Years of Service
User Offline
Joined: 3rd Nov 2015
Location:
Posted: 3rd Nov 2015 20:59


No luck still can't do anything
Rickynzx
12
Years of Service
User Offline
Joined: 19th Dec 2011
Location: Troon, Scotland
Posted: 4th Nov 2015 21:42 Edited at: 4th Nov 2015 21:43
try the command getvirtualbuttonpressed() instead of getbuttonpressed()

This should work

Login to post a reply

Server time is: 2024-04-19 11:09:24
Your offset time is: 2024-04-19 11:09:24