Change Radius of ball on the fly

hay everyone, I am making a game with a tiny ball, where you need to click on it to shoot it. On the device it is hard to click, so I increased the radius but that caused the ball to hit things too early. So, I am wondering if it is possible to set the radius of the ball to big, and then when the ball is clicked or shot, it becomes small?

--Thanks in Advance--

create a circle that's bigger then the ball but not visible and have it follow the balls x, y then set all touch events to this but leave all collision events on ball

You are a genius!

glad I could help

One other thing, I can't seem to create a global variable. For example the score the user received on level one display on level 2. Do you know how to do this?

is each level in a different file or all in one file

different lua file

are you using director

yes sir

if using director 1.4 you can pass params from one file to another

director:changeScene( params, file, fx )

params must be a table

heres an example but uses popup instead of changeScene

http://developer.anscamobile.com/forum/2011/09/29/director-popup-error

I am not catching on this one, can you elaborate a little bit. I couldn't figure it out form the other forum area either=(

say this the items you need to pass to each level

score = 100

director:changeScene( { sc = score }, "level2", "fade" )

then in level 2

function new( params )

score = params.sc[1]

and repeat for each level

This didn't work for me =( I changed everything for my needs, but it didn't change the scene

could you post some code

1.lua

score1 = display.newText("0", 0, 0, "ChalkDust", 13)
score1:setTextColor(255, 255, 255)
score1.x = 60
score1.y = 40
localGroup:insert(score1)

when the ball is hit
score1.text = score1.text + ("1")

director:changeScene( { sc1 = score1 }, "2", "fade" )

2.lua

function new( params )

scorebs1 = params.sc1[1]
scorebs1.x = 400
scorebs1.y = 40

end

not sure if it will pass an object never tried what it will pass is the value of score and you create a new score text object or maybe try leaving the [1] off im not at home on my computer to make sure its right

Ok, when you know, could you please please email kurtbringsjord@swelloapplications.com with the info.

--Thanks SOOO much for all of your help, you have been huge!

try

sc1 = { score1 }

director:changeScene( sc1, "2", "fade" )

then in 2.lua

scorebs1 = sc1[1]

think this will work still not sure about pass the text image though

It didn't work =(

I have a small app that I'm building to demo a particle system I've been building that passes a variable from one file to the next with changeScene I'll send to you to look at when I get home

file sent

Ok sweet Thanks, you are awesome!!

views:1379 update:2011/10/17 8:58:49
corona forums © 2003-2011