I have a rectangle of space and I want it to display something else when that rectangle is touched.
I think if I use CurrentTouch I can do it but I’m not sure, maybe something like
If CurrentTouch.x = ___ then do ____ else do continue
I have a rectangle of space and I want it to display something else when that rectangle is touched.
I think if I use CurrentTouch I can do it but I’m not sure, maybe something like
If CurrentTouch.x = ___ then do ____ else do continue
Does this have anything to do with your other post.
Nope. Different project.
@NoobieCoder, if you only have a month to finish and you aren’t sure where to start, I wouldn’t try and start another project at the same time… Just my opinion.
@NoobieCoder Does this help. Code changed from original post.
-- Scorpio Races App
displayMode(FULLSCREEN)
-- Function for setup
function setup()
print("Novemeber Magic Theme Park App!")
str=""
end
-- This function gets called once every frame
function draw()
-- Background
background( 0 )
--Rectangles for Display/Tabs
--fill(30, 32, 54, 255)
--rect( 0, 0, 9000, 650 )
--Box1
fill(255, 166, 0, 255)
rect( 0, 650, 260, 300 )
--Box2
fill(251, 255, 0, 255)
rect( 260, 650, 260, 300 )
--Box3
fill(12, 255, 0, 255)
rect( 520, 650, 260, 300 )
--Box4
fill(0, 71, 255, 255)
rect( 780, 650, 260, 300 )
--Texts
fill(255,0,0)
text("Welcome to the November Magic Theme Park!", 500, 500)
text(str,sx,sy)
--Cursor
--fill( 255, 0, 0 )
--ellipse ( CurrentTouch.x, CurrentTouch.y, 30 )
--TouchSelection
end
function touched(t)
if t.state==BEGAN then
if t.x>0 and t.x<260 and t.y>650 and t.y<950 then
str="Display text in box 1"
sx=130
sy=930
end
if t.x>260 and t.x<520 and t.y>650 and t.y<950 then
str="Display text in box 2"
sx=390
sy=930
end
if t.x>520 and t.x<780 and t.y>650 and t.y<950 then
str="Display text in box 3"
sx=650
sy=930
end
end
end
Doesn’t seem like it. This is my current code:
-- Scorpio Races App
-- Function for setup
function setup()
print("Novemeber Magic Theme Park App!")
end
-- This function gets called once every frame
function draw()
-- Background
background( 0 )
--Rectangles for Display/Tabs
fill(30, 32, 54, 255)
rect( 0, 0, 9000, 650 )
--Box1
fill(255, 166, 0, 255)
rect( 0, 650, 260, 300 )
--Box2
fill(251, 255, 0, 255)
rect( 260, 650, 260, 300 )
--Box3
fill(12, 255, 0, 255)
rect( 520, 650, 260, 300 )
--Box4
fill(0, 71, 255, 255)
rect( 780, 650, 260, 300 )
--Texts
fill(255,0,0)
text("Welcome to the November Magic Theme Park!", 500, 500)
--Cursor
fill( 255, 0, 0 )
ellipse ( CurrentTouch.x, CurrentTouch.y, 30 )
--TouchSelection
end
I want it so that in every time you touch the rectangle, it is like a tab, and displays different information.
@NoobieCoder I changed my code above. Is that more like what you’re after. Tap each square.