Page 2 of 3
Re: Is it possible to make this game
Posted: Tue Oct 16, 2012 12:19 am
by sturgis
There is a lot of stuff that i'm sure it does really well, and most likely anything you are doing is possible with AE (though like I say, haven't used it much so you'll have to make your own decision as to whether it is right for you) I think you can get a trial of AE and try things out.
Yep just checked.
http://www.runrev.com/store/product/animation-engine-5/ has the option to download the trial.
In my case I prefer to understand the how and why, and am not so much interested in completing a full blown project. (with some exceptions)
Also, if anyone reading the thread is interested in the game side but haven't purchased LC yet, I think you can go through the summer academy game course for no charge. (shoot
support@runrev.com questions about this they can let you know if i'm right or wrong) Its a pretty darn good course and goes through quite a bit of stuff including simulation of gravity (kinda) object animation and the like. Its a fun course.
salman.r1BUSYiYh wrote:hmmm to buy or not to buy
only reason is it seems like it would speed up the process in alot of things such as the math stuff discused before
Re: Is it possible to make this game
Posted: Wed Oct 24, 2012 4:05 pm
by salman.r1BUSYiYh
hi guys
well so far i have done this but dont know if i am going along the right line
on the image (the ball) i done this:
on mouseDown
pointsToVec
end mouseDown
Re: Is it possible to make this game
Posted: Wed Oct 24, 2012 4:09 pm
by salman.r1BUSYiYh
hi guys
well so far i have done this but dont know if i am going along the right line
on the image (the ball) i done this:
on mouseMove
pointsToVec
end mouseMove
and then on the card script i done this:
on pointsToVec px,py,px2,py2
wait 50 ticks
put the loc of image "Ball" into lBallLocation
put item 1 of lBallLocation into px--grabing location of px cord
put item 2 of lBallLocation into py--grabbing location of py cord
put px+py into pTotal
put item 3 of lBallLocation into px2
put item 4 of lBallLocation into py2
put px2+py2 into xTotal
put xTotal-pTotal into difTotal--difference of two positions (large-small)
set the loc of image "Ball" to px,py
--time to do the angle,speed,bounce below
end pointsToVec
the reason why i have come to a halt is because i cant seem to find a way to test if the cordinates are being grabbed
Re: Is it possible to make this game
Posted: Wed Oct 24, 2012 8:40 pm
by sturgis
A few things.. pointsToVec is defined as accepting 4 parameters. starting point, and ending point. px and py are starting point, px2 and py2 are ending point.
You're not passing any parameters though so i'm not sure exactly what you're trying to accomplish.
on mouseMove will fire for every single wiggle of the mouse, but then you wait 50 ticks which is close to a full second.
Then, you use the loc of your ball with item 1 and item 2 which should be fine, but then try to get item 3 and 4. A loc, meaning "location" is a single point at the center of the object so there are only 2 items. The x position and the y position.
So, I guess the best way to go about this is to ask you what you are trying to accomplish with the code, and how you want the ball to behave so that it is easier to advise you. Also, if you're interesting in this sort of thing you should go through the game academy. It was a great course!
salman.r1BUSYiYh wrote:hi guys
well so far i have done this but dont know if i am going along the right line
on the image (the ball) i done this:
on mouseMove
pointsToVec
end mouseMove
and then on the card script i done this:
on pointsToVec px,py,px2,py2
wait 50 ticks
put the loc of image "Ball" into lBallLocation
put item 1 of lBallLocation into px--grabing location of px cord
put item 2 of lBallLocation into py--grabbing location of py cord
put px+py into pTotal
put item 3 of lBallLocation into px2
put item 4 of lBallLocation into py2
put px2+py2 into xTotal
put xTotal-pTotal into difTotal--difference of two positions (large-small)
set the loc of image "Ball" to px,py
--time to do the angle,speed,bounce below
end pointsToVec
the reason why i have come to a halt is because i cant seem to find a way to test if the cordinates are being grabbed
Re: Is it possible to make this game
Posted: Thu Oct 25, 2012 12:09 am
by salman.r1BUSYiYh
Ok
but i thought the game academy was for a sidescroller game like galactic gauntlet?
Re: Is it possible to make this game
Posted: Thu Oct 25, 2012 12:26 am
by sturgis
That is the example used yes, but there is a lot of useful info in there. There is code for a game loop, animation of the backgrounds and rocket itself, speed control etc. The information on moving things around in general is very helpful and applies to more than "just" a sidescroller.
Also, while the code isn't so great, and doesn't really use the functions posted here earlier, I have some stacks I can post that might help if you like. The start of an asteroids game, the start of a breakout game, and for mobile, code that uses the accelerometer to roll a "ball" around the screen.
Let me know if you're interested and i'll clean them up a bit and post what I have. All 3 use the gameloop code from the game academy.
salman.r1BUSYiYh wrote:Ok
but i thought the game academy was for a sidescroller game like galactic gauntlet?
Re: Is it possible to make this game
Posted: Thu Oct 25, 2012 5:10 am
by dave_probertGA6e24
Sturgis. In what world does 5 + 5 make 8 ????? The answer is Ten - obviously
But the digits 10 are not Ten - they are 1 unit of base and 0 units of units.
Now what would 9 + 4 = ?
Ah, the fun of maths

Re: Is it possible to make this game
Posted: Thu Oct 25, 2012 6:15 am
by salman.r1BUSYiYh
Sturgis
Yes if you can post the stacks up that would Be great
Re: Is it possible to make this game
Posted: Thu Oct 25, 2012 2:05 pm
by salman.r1BUSYiYh
Another thing confusing me is how livecode will detect a 'swipe' the mouseUp is like a click isnt it not. I thought that 'mouseMove' was when a user drags on a image then you could direct the ball and add speed etc but i guess i was wrong on that part
Re: Is it possible to make this game
Posted: Thu Oct 25, 2012 2:51 pm
by sturgis
Ok, here is the start of a marble maze. The resizing based on device is not there yet, its set basically for a kindle, so you'd want to either add code for resizing, or adjust things to match the device you're testing on.
I added a yellow box so that you can mess with it on the desktop tool. Click and hold in the yellow square and move the mouse. It acts like a tilt yoke making the ball move around. The slider on the right adjusts the behavior of the ball (around 3 or 4 seems best)
The code is a mess, but hopefully there will be something useful in there. Oh, and the game loop is in the stack script, and thanks to the game academy. If you have an error that causes the game loop to quit cycling the easiest way to get it going again is close and reopen. Here is the link.
https://dl.dropbox.com/u/11957935/lmmcurrent.livecode -- the links will eventually go away. The next time I move stuff around, so grab them now!
The next 2 are only currently set up for desktop. First is the breakout. Clicking start will create a single row of blocks, and start the ball moving. The same gameloop is used in the stackscript. Probably don't want to have more than 1 of these stacks running at a time to avoid lag issues. Arrow keys move the paddle, there is no wins or losses, just the moving ball and paddle.
https://dl.dropbox.com/u/11957935/break ... t.livecode
finally, here is the asteroids. Up arrow accelerates, left and right rotate. Spacebar shoots. (kinda) So far only 1 tiny asteroid (unshootable, but it spins nicely) is on screen. Well plus a big one that does nothing. No flames on this version, no sound on any of the game starts. Here is the link.
https://dl.dropbox.com/u/11957935/Aster ... t.livecode
Re: Is it possible to make this game
Posted: Thu Oct 25, 2012 2:57 pm
by sturgis
The answer is... that I think my last brain cell just dribbled out my left ear. So the question is, if a brain cell leaves the skull at 4 miles an hour heading left, with a 4 degree leftward head tilt causing an increasing velocity, but with a stickiness quotient of 3 causing deceleration, how long does it take the cell to reach the earlobe?
dave_probertGA6e24 wrote:Sturgis. In what world does 5 + 5 make 8 ????? The answer is Ten - obviously
But the digits 10 are not Ten - they are 1 unit of base and 0 units of units.
Now what would 9 + 4 = ?
Ah, the fun of maths

Re: Is it possible to make this game
Posted: Tue Oct 30, 2012 12:14 am
by salman.r1BUSYiYh
ok guys so i found a bit of code online for the swipe
i still need to learn on arrays so yeah it should be interesting, but am i on the right track?
i mean it all seems to make sence i.e apply to my game
Re: Is it possible to make this game
Posted: Tue Oct 30, 2012 12:14 am
by salman.r1BUSYiYh
Code: Select all
on touchStart pID
## When the user touches the screen
put empty into sCoordinateArray["start"]
put empty into sCoordinateArray["end"]
end touchStart
on touchMove pID, x y
if sCoordinateArray["start"] is empty then
put x into sCoordinateArray["start"]
else
put x into sCoordinateArray["end"]
end if
end touchMove
on touchEnd
put sCoordinateArray["start"] into tStart
put sCoordinateArray["end"] into tEnd
## Compare the x coordinates of the start and end point
## This tells us the direction of the movement
if tStart is not empty and tEnd is not empty then
if tStart > tEnd and tStart - tEnd > 100 then
moveForward
else if tStart < tEnd and tEnd-tStart > 100 then
moveBack
end if
end if
put empty into sCoordinateArray["start"]
put empty into sCoordinateArray["end"]
end touchEnd
Re: Is it possible to make this game
Posted: Tue Oct 30, 2012 5:01 am
by dave_probertGA6e24
Hi Salman,
That code will handle a left-right (horizontal) swipe, but would need a lot of enhancing to handle an angular swipe. It only stored the x-coordinate of the swipe data.
You should store both the x and y at the start and end. Then construct the arithmetic to calculate the line details from those pair of x,y coords. You should be able to get both the swipe length and angle from that quite easily.
Generally though, it's a good way to handle the touch events.
Cheers,
Dave
Re: Is it possible to make this game
Posted: Thu Nov 01, 2012 3:51 pm
by salman.r1BUSYiYh
ok so i enhanced the code a litle bit so it reads both x and y coords, well i think its right
Code: Select all
local sGameRunning
on startGame
put true into sGameRunning
end startGame
on stopGame
put false into sGameRunning
end stopGame
on updateScreen
if sGameRunning is true then
flyBall
end if
end updateScreen
on touchStart flyBall
## When the user touches the image
put empty into sCoordinateArray["start"]
put empty into sCoordinateArray["end"]
end touchStart
on touchMove x,y
if sCoordinateArray["start"] is empty then
put x into sCoordinateArray["start"]
put y into sCoordinateArryay["start"] ##the extra line of code i put in
else
put x into sCoordinateArray["end"]
put y into sCoordinateArray["end"]##the extra line of code i put in
end if
end touchMove
on touchEnd
put sCoordinateArray["start"] into tStart
put sCoordinateArray["end"] into tEnd
end touchEnd