How to make hitboxes in App inventor?

372 views
Skip to first unread message

Joonas Hiltunen

unread,
Feb 15, 2017, 6:25:24 AM2/15/17
to mitappinv...@googlegroups.com
So I'm doing little car game in appinventor.
My problem is that I have parking lot which size isn't the whole screen size. Parking lot is about in center of the screen. I would like to have hitboxes that could stop the car and prevent it to go out of the parking lot. I tried already making a new imagesprite and in the code section I put "when car collided with imagesprite", "set car speed to 0". But that worked only one time. I can now press the gas button again (after the car stopped) and then the car continues going. Blackbar on the left up corner is the hitbox1

Does anybody have any suggestions how could I make hitboxes and prevent the car to get out of the parking lot from the spot where I don't want it to get out.
If you need more specific information please just ask

Nico Marikucza

unread,
Feb 15, 2017, 12:54:48 PM2/15/17
to mitappinv...@googlegroups.com
You can add a global variable: stop. In the block "When Truck.CollidedWith" is the block "if get other = HitBox1". In the socket "then" you can add a "set" block fom the Variables. Set the variable to "global stop" and pair a "true" block with the socket "to". The "set Truck.Speed to" block must stay. In the "when Gas.TochDown" block can you pair a "if then" block, in the socket "if" can you add a "=" block, with the global variable "global stop" and "false". It should look like this:

Nico

Reply all
Reply to author
Forward
0 new messages