Hey peach, check this out! http://mobile.tutsplus.com/tutorials/corona/corona-sdk-accelerometer/
Hope that helps.
// red. [import]uid: 7143 topic_id: 2614 reply_id: 9017[/import]
Hey peach, check this out! http://mobile.tutsplus.com/tutorials/corona/corona-sdk-accelerometer/
Hope that helps.
// red. [import]uid: 7143 topic_id: 2614 reply_id: 9017[/import]
I was looking for that earlier as I remembered seeing it, then wondered if I’d imagined it as I couldn’t find it for some reason.
Thanks very much, I’m sure it will be a great help
One other question for you, or anyone else who might know - is it possible to have a physics object, how to word it… “stay upright” or the like? It rotates when hit with other objects but I’d prefer it didn’t.
Thanks for the help, both that just given and that I will hopefully get from you, or someone else, over this
PS - I’m slowly improving. I think in a month or so I MIGHT have a half decent game. We’ll see ^-^; [import]uid: 10144 topic_id: 2614 reply_id: 9034[/import]
Object.isFixedRotation=true [import]uid: 7911 topic_id: 2614 reply_id: 9035[/import]
local heroright = display.newImage("heroright.png")
heroright.x = centerX
heroright.y = 130
heroright.isFixedRotation = true
What am I doing wrong? I’m sure it’s something silly and obvious but my understanding at this stage about this sort of thing is really limited and I’m having trouble with it.
Sorry to be noobish, lol. [import]uid: 10144 topic_id: 2614 reply_id: 9037[/import]
physics.addBody( heroright, {} ) [import]uid: 7911 topic_id: 2614 reply_id: 9040[/import]
This is what I would do!
Also I dont think centerX is the way to position it in the center, use
[blockcode]
(display.contentWidth / 2)
(display.contentHeight /2)
[/blockcode]
[blockcode]
local heroright = display.newImage(“heroright.png”)
heroright.x = (display.contentWidth / 2)
heroright.y = 130
local function run()
heroright.rotation=0
end
Runtime:addEventListener( “enterFrame”, run )
[/blockcode]
-Gamexcb [import]uid: 8517 topic_id: 2614 reply_id: 9039[/import]
Gamexcb - that works perfect, thank you.
Jstrahan - I had that but missed the line from my copy paste accidentally.
Now, I have one or two other questions I’d like to ask while it seems a good time to get help
That one isn’t urgent but I’d like to know as it may be needed soon.
Thanks to both of you; if you can’t help that’s fine too - obviously it’s early days for all of us and while you’re both ahead of me I don’t expect you to know it all. Yet [import]uid: 10144 topic_id: 2614 reply_id: 9041[/import]
Sorry I don’t have any time right now gotta work but I don’t feel I’m ahead of you we just started in different places
Any way to move left and right just use object.x=object.x (+ or -) # of pixels is one way or you could apply force in a direction
Check the API under physics and you’ll see what I’m talking about
So bye for now gotta get back to work [import]uid: 7911 topic_id: 2614 reply_id: 9047[/import]
It’s cool, you were a big help with the other problems I was having so cheers for that
I’ll keep at this, I’ll get it eventually [import]uid: 10144 topic_id: 2614 reply_id: 9114[/import]
@peachpellen - Did you ever find out the answer to your second question (hero able to go through left and right walls)? I’m having the same problem (new to Corona…GS convert). My object moves with ease and will bounce off the left and right walls. However, unlike the floor, if enough tilt is given it will begin to “go through” the wall and eventually fly past it. Any suggestions? [import]uid: 12894 topic_id: 2614 reply_id: 16797[/import]
I can’t remember 100% but I believe what I did was something like this;
local function keeponscreen (event)
if hero.x \< 0 then
hero.x = 0
end
if hero.x \> 480 then
hero.x = 480
end
if hero.y \< 0 then
hero.y = 0
end
if hero.y \> 320 then
hero.y = 320
end
end
Runtime:addEventListener("enterFrame", keeponscreen)
That would be for a landscape game, obviously you’d want to play with x and y values and such, but I think it should help - please let me know [import]uid: 10144 topic_id: 2614 reply_id: 16800[/import]
Thanks! I’m not sure why one would need to do that, but it works!
While it doesn’t affect my needs for this current project, I do wonder how that may affect a project where it needs to bounce off that wall. I do notice that because of the new constraints, it just doesn’t pass the wall…bounce seems to be affected. I guess I’ll cross that on a different project. Thanks again!
BTW, I used to see your posts on GS and I have now enjoyed your Techority blog! Thanks for your willingness to help!
[import]uid: 12894 topic_id: 2614 reply_id: 16807[/import]
I’m sure I did get whatever it was bouncing, I just can’t remember with any certainty where the problem was - I am glad that this will work for your current project and I will attempt to work out a bounce-friendly-fix in the coming weeks to put up on Techority for you and others
I’m glad you remember me from GS and enjoy Techority - thanks a lot!
And no worries re the willingness to help, I’m pretty community minded - the Corona community is the BEST after all ^-^; [import]uid: 10144 topic_id: 2614 reply_id: 16808[/import]
I love your tutorials and how you put concepts in a small and easy way to understand. I know you’re quite busy, so I was wondering if u knew of similar tutorials ? I can’t seem to grasp how to detect a collision. All I’m wanting to try is if a ball hits a blue box it adds to the score, or goes to next scene. If it collides with a red box I want it to do something else. the snippet that I’ve seen has made it hard to understand what is taking place. do u know of a tutorial that helped you? [import]uid: 12894 topic_id: 2614 reply_id: 16998[/import]
Thank you William
As to similar tutorials - no! Sadly The reason I started writing my own was because I wished they’d existed for me to learn from.
For collision detection I can try to put something together later in the week - if the app I’m working on for someone else gets sorted (he’s having some certificate/signing issues on his end, which obviously carry over to mine) I will post something then.
I’d attempt to explain it but it’s all a bit confusing. I eventually pieced it together looking at the example on this site with the two crates colliding, so maybe look at that.
Sorry I can’t be more helpful (yet!) - I just woke up and the aforementioned certificate issue is driving me up the wall XD
If this gets sorted out I will update the 48 hour challenge page and then attempt to create both a new set of tutorials for newbies, a tutorial on collision detection and maybe a tutorial about a scrolling background as some people might like that too.
/endwalloftext
Peach [import]uid: 10144 topic_id: 2614 reply_id: 17025[/import]
Hey Peach…
I didn’t mean to be rude and ignore your reply…I have been quite ill for about a week, but I think the worst is over.
Anyway, thanks for the reply. I look forward to future tutorials! In the mean time, I’ll check out the crates example that you mentioned. Thanks again! [import]uid: 12894 topic_id: 2614 reply_id: 18413[/import]
Not a problem William - my sympathies regarding your being unwell.
I hope it passes in a day or two and am pleased to hear that the worst seems over [import]uid: 10144 topic_id: 2614 reply_id: 18467[/import]