Page 1 of 1

App speed up

Posted: Sat Nov 30, 2013 11:40 am
by itay1023
Hi,
I am buildong a game for iOS platform.
When i tested it on my iOS device, the game worked slow....
Can someone give my a code or something that will speed up my game?

Best regards,
Itay

Re: App speed up

Posted: Sat Nov 30, 2013 6:58 pm
by jmburnod
Hi Itay,

Did you use acceleraterendering ?

Best regards
Jean-Marc

Re: App speed up

Posted: Sun Dec 01, 2013 10:10 am
by itay1023
Yes, but it still works slow.

Re: App speed up

Posted: Sun Dec 01, 2013 10:36 am
by Simon
Hi itay1023,
I've seen that you have posted a few questions that you've not received a reply to.
It's best if you showed code to what you have tried, and a description of what you are trying to do with examples.

Yep... scorlling a 24 MB image will be slow... is that what you are doing?

You see? I can keep asking question like that for about... ummm 20 seconds then I don't want to play guessing games any more.

Would you like help?

Simon

Re: App speed up

Posted: Sun Dec 01, 2013 10:50 am
by itay1023
Yes, i do.

Re: App speed up

Posted: Sun Dec 01, 2013 11:34 am
by Jellicle
itay1023 wrote:Yes, i do.
Then show us your code.

Gerry

Re: App speed up

Posted: Sun Dec 01, 2013 11:46 am
by itay1023
That's the image code:
local LocVar
global _life
global _startTheGame
global _score
global blackVar

on mouseDown
if _startTheGame is true then
put the loc of me into LocVar
grab me
send theButtonVar to me
end if
end mouseDown

on mouseUp
set the loc of me to LocVar
end mouseUp


on theButtonVar
if intersect (btn "theButton" of card "gameCardNew", button "blueBubble" of card "gameCardNew", 50) then
hide button "blueBubble" with visual effect dissolve fast
set the loc of btn "blueBubble" to 581,269
add 10 to _score
put _score into fld "score" of this card
hide btn "blueBubble"
send theButtonVar2 to me in 0.001 seconds
else
send theButtonVar2 to me in 0.001 seconds
end if
end theButtonVar

on theButtonVar2
if intersect (btn "theButton" of card "gameCardNew", button "redBubble" of card "gameCardNew", 50) then
add -1 to _life
put _life into fld "life"
hide button "redBubble"
set the loc of btn "redBubble" to 581,269
SavedRedBubbleActions
send theButtonVar3 to me in 0.001 seconds
else
send theButtonVar3 to me in 0.001 seconds
end if
end theButtonVar2

on theButtonVar3
if intersect (btn "theButton" of card "gameCardNew", button "goldBubble" of card "gameCardNew", 50) then
add 100 to _score
put _score into fld "score"
hide btn "goldBubble" of card "gameCardNew"
set the loc of btn "goldBubble" to 581,269
send theButtonVar4 to me in 0.001 seconds
else
send theButtonVar4 to me in 0.001 seconds
end if
end theButtonVar3

on theButtonVar4
if intersect (btn "theButton" of card "gameCardNew", button "blackBubble" of card "gameCardNew", 50) then
add -50 to _score
hide btn "blackBubble"
set the loc of btn "blackBubble" to 581,269
put _score into fld "score"
send theButtonVar5 to me in 0.001 seconds
else
send theButtonVar5 to me in 0.001 seconds
end if
end theButtonVar4

on theButtonVar5
if intersect (btn "theButton" of card "gameCardNew", btn "heartBubble" of card "gameCardNew", 50) then
add 1 to _life
put _life into fld "life" of card "gameCardNew"
hide btn "heartBubble" of card "gameCardNew"
set the loc of btn "heartBubble" to 581,269
send theButtonVar to me in 0.001 seconds
else
send theButtonVar to me in 0.001 seconds
end if
end theButtonVar5

Re: App speed up

Posted: Sun Dec 01, 2013 2:09 pm
by Klaus
Hi Itay,

you are sending your messages in a too short intervall and end up with 5 commands per millisecond!
And you do not stop checking at any point!?
That will surely slow down everything to a still life 8)

Try this and check my comments:

Code: Select all

local LocVar
global _life

## Store the ID of the last SEND in a variable, so you can CANCEL it on "mouseup"!
## No need to check when the mouseis '"UP", right?
local tMessageID

global _startTheGame
global _score
global blackVar

on mouseDown
  if _startTheGame =FALSE then
    exit mousedown
  end if
  put the loc of me into LocVar
  grab me

  ## Since this is ONE part of your complete "Collision detection" routine it should be called immaediately!
  ## No need to send it here.
  theButtonVar
end mouseDown

on mouseUp
  set the loc of me to LocVar

  ## Now cancel the last SEND!
  cancel tMessageID
end mouseUp

on theButtonVar
  if intersect (btn "theButton" of card "gameCardNew", button "blueBubble" of card "gameCardNew", 50) then

   ## A visual effect will also slow down things!
   ## NOTHING will happen during the effect!
   ## So maybe you wnat ot comment this out?
    hide button "blueBubble" ## with visual effect dissolve fast
    set the loc of btn "blueBubble" to 581,269
    add 10 to _score
    put _score into fld "score" of this card
    hide btn "blueBubble"
  end if

  ## See above...
  theButtonVar2
end theButtonVar

on theButtonVar2
  if intersect (btn "theButton" of card "gameCardNew", button "redBubble" of card "gameCardNew", 50) then
    add -1 to _life
    put _life into fld "life"
    hide button "redBubble"
    set the loc of btn "redBubble" to 581,269
    SavedRedBubbleActions
  end if

  ## See above...
 theButtonVar3
end theButtonVar2

on theButtonVar3
  if intersect (btn "theButton" of card "gameCardNew", button "goldBubble" of card "gameCardNew", 50) then
    add 100 to _score
    put _score into fld "score"
    hide btn "goldBubble" of card "gameCardNew"
    set the loc of btn "goldBubble" to 581,269
  end if
  theButtonVar4
end theButtonVar3

on theButtonVar4
  if intersect (btn "theButton" of card "gameCardNew", button "blackBubble" of card "gameCardNew", 50) then
    add -50 to _score
    hide btn "blackBubble"
    set the loc of btn "blackBubble" to 581,269
    put _score into fld "score"
  end if
  theButtonVar5
end theButtonVar4

on theButtonVar5
  if intersect (btn "theButton" of card "gameCardNew", btn "heartBubble" of card "gameCardNew", 50) then
    add 1 to _life
    put _life into fld "life" of card "gameCardNew"
    hide btn "heartBubble" of card "gameCardNew"
    set the loc of btn "heartBubble" to 581,269
  end if
  
  ## NOW send your routines in a short interval:
  ## hte message you want ot send in QUOTES!
  send "theButtonVar" to me in 100 millisecs

 ## STORE messages ID:
  put the result into  tMessageID 
end theButtonVar5
Best

Klaus