# About game logic

• Hi everyone, can someone in this forum be kind enough to help me understand how the "game logic" works in sample games like "tiny plane" in hyperpad?

I am an English teacher from the Philippines who is at present trying to finish a dissertation on teacher-made educational games for developing target grammar and writing competencies in English.

I would really appreciate an audience with someone who can walk me through this so I can finally have the confidence to start making the game I have in mind.

Basically, I have no programming language background but have creative classroom activity ideas so I find myself as an ideal representation of the many teachers here in my country who can take advantage and be creative with the visual programming tool such as the hyperpad. I really want to make this app accessible to millions of teachers here in the country through my research. So I would humbly appreciate any help I can get from you guys here at this point.

Been contacting sir hamed but it seems he's so busy on weekdays lately so, I am kinda desperate to seek anyone's help here right now.
I am available on monday to friday guys preferably early in the morning and late at night since I am working 8:00-5:00pm here in the Philippines as a professor in our university.

Thank you so much. Godspeed and more power to hyperpad and you all!š

• @Aries29 In case you didn't know, editing people's projects lets you see the behaviours used, which can be pretty helpful if you're wondering how something specific works. I'd be happy to help, though I can't guarantee I'll always have time. You mentioned ebook games in your other post; if you mean something similar to the three bears interactive story example, you could take a look at the tutorial here if you haven't already.

• @Jack8680

Hi there Jack!

Well, I have tried to decode how the tiny plane game works but all I can see inside it is the "game logic" behavior which i suppose does the random computation as to where the objects would appear on screen after the tiny plane has passed the obstacles on screen. If you can find time, can you help me understand how that sample game works? Will check out the tutorial you posted as well. Thank you so much in advance for your reply sir.

• @Aries29 I took a look in the behaviours, and they are a bit hard to follow, so I did my best to write out what I think everything does:

There is a big hidden button on a layer above everything except scene and global UI. The behaviours inside the plane show that tapping it the first time makes the plane a physics object and broadcasts a "start game" message. Every tap after the first will set its velocity to 0 and then apply a force in the y (vertical) direction. This means that when you tap, the plane gets launched up.

The physics engine within hyperPad itself causes it to fall back down again, because of the gravity value in the global properties of the project. The tap also spawns a particle object called "Puff-1" on the plane, which is the puff of smoke that appears behind the plane.

The mountains and the ceiling (and upside-down mountains) are in a tag called "wall". The plane uses the collided behaviour with the tag, with a behaviour off to disable the touch behaviour that makes the plane jump. Then it falls down until it hits the barrier at the bottom of the screen. Another collided behaviour detects the collision with the bottom and makes the plane a scenery object to stop the physics from acting on it. It also broadcasts messages "Stop" and "Did lose".

There is a timer in the plane that does some math [arctan(VY*2)] where VY is the y velocity from the get velocity behaviour and rotates the plane to this angle, but it doesn't seem to be working (unless I accidentally broke it looking through the behaviours).

Onto the game logic label, right at the start it deletes the existing mountains and score detector, and when "start game" is received, it spawns a set of mountains and a score detector on the right side off the screen after using a random number to determine the position of them and set them as attributes, and then starts a repeating chain of behaviours that use behaviour on with skip events to activate randomly every 1.5 to 3 seconds to keep picking a random height and spawn another score detector and set of mountains. This repeating chain is turned off when the message "stop" is received.

The score detector is a hidden object that sits vertically in between the top and bottom mountains and slightly to the right, and moves with them. It broadcasts "Did score" when it collides with the player and plays a sound.

The mountains and the score detector all first move to the positions determined by the game logic by getting the game logic attribute of "pipe top pos", "pipe score pos", and "pipe bottom pos", for their respective object. They then move left by setting their x velocity to the "speed" attribute of the game logic multiplied by -1 (so they move left at the speed). Their velocity is set back to 0 when they receive the "stop" message. The speed attribute is 5 at the start of the game and doesn't seem to ever change.

When "Did lose" is received by the game logic, the score layer is hidden and the scene UI layer (which is hidden at the start of the game) is shown; the game over screen. The scene is restarted if the player presses play.

Feel free to ask for clarification for things, I know I skipped some. Also, I can help with anything specific you need help with in your projects.

Edit: the mountains disappear offscreen because the behaviour that spawns them has "recycle" turned on and a limit of 5, so when there are 5, every new one spawned deletes an old one, in the order they were created.

• I would really appreciate if we can have a skype video call session about this Jack. I would much appreciate if you can show this visually so that I could get your point faster. You see, that's the reason why I was contacting Sir Hamed directly so that he can explain what is "behind" the game logic he used in this game. Because as you know, I am trying to create eBookgames for English wherein student players can have random experiences in learning predetermined skills in the game (focusing on grammar awareness and writing composition in particular). I see a lot of potential for this app in the education sector where contextualization of concepts is scarcely done by teachers. So I would really appreciate if you can help me start showing them how simple it is to do this using hyperpad.š

• @Aries29 I'm not sure how I could explain it visually with Skype, I can't share my iPad screen that way. I'm more comfortable typing messages rather than a video chat too. If you explain your game concept in more detail (perhaps a chat message), I can help you make it in hyperPad (if it's a commercial project I'm not willing to do everything though).

• @Jack8680 Hi Jack!!!

I'm sorry for not being able to respond to your message last time, been stuck at work lately. Uhm, are you willing to have a skype session with me one of these days so we can chat about the educational game idea I intend to work on? It's not commercial so I really hope you can help me wheheartedly about it. Thanks!š

• @Aries29
Please don't harass the other users about skype calls. Jack already mentioned he's not comfortable going on skype (which is very understandable).

You're more then welcome to ask questions on the forum. But please don't ask users for personal information, or to set up skype calls. Especially if they already said no.

Plus, @Jack8680 has already gone above and beyond to explain how the project is constructed!

• @Murtaza
I think this is a miscommunication. I already know that he is not comfortable with it so I just wanted to text chat via skype with him. Not videocall. I mean no harm here especially to him for I was humbly seeking his help and "harass" is a bit too much in my opinion for you to use without even asking what exactly I meant with what I said.

I suggest you try to be more gentle with your words sir. We already talked once and you know very well that I am not a bad person. I suppose you should rectify what you said here before I take offense.

• @Murtaza
I'm sorry if my being so eager to learn this app for my study made you and jack feel disrespected; but I believe that none of my words are disrespectful at all. I am a teacher by profession so I know what respect is. It is I who felt disrespected when you said I "harassed" someone here where in fact, I never said anything remotely close at all to that word. As soon as you read this, I suggest you rectify what you said about me sir because this time, it was YOU WHO JUST DID THAT TO ME.

• @Aries29 I agree there's been a miscommunication, I thought by Skype session you meant call too. I don't have Skype, but you can message me through the forums or email/iMessage at jackdew31@icloud.com. Also, I think Murtaza meant harass as in nagging, since it seemed like you were asking again after I said I wasn't comfortable Skype calling (just a miscommunication). I'll still gladly help with your project though.

• Once again, I apologize if you felt I was being disrespectful. That wasn't my intention when I wrote it.

It was definitely a misunderstanding since you said again you want to have a skype session. This usually means video and voice chat.

One thing you need to remember hyperPad has users of all ages. Sometimes it's not appropriate to ask them to have a private chat with you. I'm sorry your feelings were hurt, but our highest priority is making sure our users feel safe and keeping their information private.

• @Murtaza
It's ok, we both misunderstood each other and I want to leave it that way.š
All I wanted was to have a real time "text-based" chat with you Jack. Hope that's clear this time.
Because I want to ask you questions and get real time response too. Plus, I would like to send you a video of a game I wish to modify for my study and, from there I want your honest opinion as to how much of it can be done with hyperpad as the game creation platform. Thanks again to both of you!š

• @Aries29

Visual coding (and its cousins in node based editing) make a lot of sense to those that understand the roots, and the "old ways" of doing things, but visual coding's deceptive "look" of simplicity completely ruins new coders by making what's going on look artificially simplistic.

Game Logic, all programming logic, is difficult to understand, initially. And forever, for most people. There's no reason to presume programming should (or even could) be done by all people. The "everyone should learn to code" crowd are out of their minds. Not everyone is suited to everything, nor should everyone do everything. Especially not coding. This is a ridiculous fallacy and no way to introduce the perils of the near infinite power of big data and its analysis by massive corporations, nor solve employment problems of the future.

Whilst an initial gaze at visual programming might make the difficult-to-consider, and foreign language that is coding, look disarmingly simple; it isn't. There's a lot of reasons visual coding hasn't taken off, but this is probably the largest of them. Coding, even when done visually, still requires understanding, containing and considering everything that's going on, most of the time, along with stacks of pre-requisite knowledge that's not natural, nor interesting, if we're being really honest.

Without all that pre-requisite guff, visual coding makes much less sense than a flat beige jigsaw puzzle.

Most people that become interested in coding self-select for it. And are experts in beige.

But for everyone of the millions pushed into exposure to coding and/or visual coding, and all those having desired/imagined and expected it will be simple to conceive of something and then perceive how to do it with code... I'm sorry. It's not natural, not simple and not elegant, even in visual, simplified coding environments like hyperPad.

Coding sucks, no matter how it's done.

However, for a minority, the cold, commanding, ruthless remoteness (and responsibility free zone) that is coding provides a relief from the rest of the world.

That's not me. I suck at coding. And languages. But can lift heavy things.

• @Aries29 I reckon you can get a decent amount of knowledge by reading the HyperPad documentation.

• @Deeeds

Let me start by appreciating your time to reply on my post here.

I know that coding is difficult; but if thereās one thing I am certain of, we all can find ways to make it simple enough to learn. Thereās no way a non-programmer can match the skills of a real programmer. That is already given.

But for a teacher like me, I believe that many people out there who are notāprofessional programmersā can certainly benefit from what hyperpad as a visual programming app offers. That is why I humbly disagree from your implied tone that apparently dissuades non-programmers like myself from learning how to code āvisually.ā Ever heard of Scratch from MIT? Thousands of teachers and students are delighted to know that they can ācreateā a game from it āwithout programming background at allā in literally just minutes. I even managed to create a cat-chasing-a-ball-then-score-with-a-timer sort of game there in just half an hour using the available code blocks, sprites, video tutorials, well illustrated pdf documentation guides, and common sense. Sir Murtaza and Sir Hamed I believe also knew and believe in the potential of many people out there to be ācreativeā using their amazing app even if they are just your ordinary kind of people who knew nothing about coding and do not basically depend their next meal on it.

The point is, hyperpad is a heaven sent for people regardless of age, profession, programming know-how, and culture. This app cuts across all boundaries and only require you to be patient enough, as with almost all things, to learn it and do amazing things with it.

Perhaps for a programmer, making a game like I did is nothing, but seeing how I managed to make the cat move with my mouse in Scratch, catch a ball that randomly appears anywhere on screen for about a second, and score a point (with sound effect) every time it manages to catch it, all without a degree or background in serious programming at all, is in itself, and to many others like me, a milestone to be proud of.

To each to his own I believe so, if you think programming āsucksā and is difficult for the rest of us ordinary people to learn, I respect āyour opinion.ā But I donāt agree with it one bit. Your pessimistic view negates the fact that hyperpad is for āthe rest of usā much like Steve Jobs once believed that technology isnāt just for geeks.

He made technology accessible to all people around the world even if they knew nothing about hard disks, ram, processor, and other mumbo jumbo tech stuffs. Thatās why iPhone was very well loved by many people (except if you are a die-hard android user) around the world since it came out in 2007. Itās not just because itās an expensive status symbol with an apple logo you know...itās because it made technology āsimple enough to understandā for people from all walks of life.

And thatās what hyperpad exactly just did in programming for the ārest of us.ā

Whether you believe me or not is entirely up to you.

Iād appreciate if you wonāt post again a response on my inquiry if you donāt have an answer to share though.

The mere existence of this wonderful app is already a direct proof that what you said about programming is NOT ENTIRELY TRUE.

Yes, it may be HARD, but it becomes SIMPLE because of hyperpad.

Chew on that.

• @Kamdroid

Hi, I already talked to Sir Hamed about it and I think the documentation you are talking about is still nowhere close to what is available for instance for Scratch, a pc and mac visual programming software. It has videos, illustrated and easy to follow start up guides, and even a book about it. But I believe hyperpad is more powerful and more intuitive. It just needs to be more documentation to be understood and appreciated much as Scratch is.š

• I could respond by discussing Piaget, Papert, pedagogy and programming... but feel it would be pointless (and perhaps even more pretentious than this response).

Instead, let's focus on what you do know: who are you teaching and why do you want them to learn programming?

• @Aries29 have you figured out your logic questions, or do you still need help?

• @Aries29 Have you seen this:

--
It's heavily inspired by (and copied from) Scratch, but more complete.

MUCH more complete.

Parses to JavaScript, Python and Swift, the three most important "modern" languages.

More support and learning materials than you can ever use.

Well funded and supported by the biggest names in the game, including Apple.