Search the Community
Showing results for tags 'shapes'.
-
There is a VECTOR game at https://www.html5pcode.com/a1yvector.htm that was designed to teach the art of coding. It uses structured programming, so it is easy to follow the logic of the design. The game is divided into small self contained pieces. It has a main program and a subprogram. The subprogram has routines that perform specific tasks when they are called by the main program. The game has links to YouTube videos that describe the operation of the main program and the subprogram routines. Once you learn how to design games like this one, you can go on to design your own games in JavaScript and/or a JS framework. This p-code lends itself to teaching coding because the source and object code are the same. The engine that created the code (source-code) is the same engine that executes the code (object-code). This makes it possible to do the following options. A DATA OPTION allows you to view the game's data, while the game is running. A TRAIL OPTION allows you to execute a few instructions at a time, so you can see what each routine is doing. A REAL TIME (RT) OPTION allows you to change instruction values, while the game is running. The YouTube videos show how these options are used in the designing of the game. There are many other games written in this p-code at https://www.html5pcode.com
-
I have a problem in plotting points when trying to create WALLS. The problem in dissection : - I have 4 points in XOZ plane That I want them to produce 4 walls, as each 2 points are a line and I want each line to become a wall by computing the other 2 points of the wall. I assume the height of the wall (3 meters, for example). This wall might contain holes later (Doors & Windows). Finally I need an enclosed room. I want to create these walls without importing from blender, I get those points from elsewhere. Here is the steps, I use to solve the problem: 1) I split the array into 4 lines. Each line contains 2 points. 2) I have to compute the 2 other points for each line. and here is the problem. I used the dimension Y which is wrong when using ExtrudedPolygon Object. So I have to work in the same XOZ plane and rotate. Here I face other problems like How to calculate the angle of rotation? plus the way of computing the 2 other points will be through having 2 data : The length of the wall (3 meter for example) and the angle which is also a variable that depends on the slope of our line. Here is a sample of my try: https://www.babylonjs-playground.com/#SF0BN6 You can find that in the last loop, I create a wall but with points that contain a Y dimension, which resulted in corrupted shape, But I hope to avoid the suffering of Computing the other 2 points in the same XOZ plane which enforces me to respect the slope of the line and so on as I illustrated in the second point. If you have any alternative ideas, I welcome that. Thanks in advance.
-
Here is my game: Curvatron. In that version (a bit outdated now) the snake's tail is drawn using a Bitmap Data. Every frame, it draws a sprite (small circle) under the snake's head, and erases the end of the tail with a clearRect. This is ugly but it was the fastest method I could find at the time, for mobile. I have been trying to find other ways to do this so that I can have a prettier version on PC, but I'm not sure which one is the best. I tried: Using Graphics, drawing the entire body with a thick line. The entire line is erased and then redrawn every frame. Same thing as 1, but with Bitmap Data. Using Bitmap Data, drawing small circles (not sprites) for each body point, for the entire body. The entire thing is erased with a clearRect every frame and then redrawn.Which one of these approaches is the best? Should I just stick to the original one? Another question: is there much of a performance difference between using a small sprite (16*16) for drawing in the BMD and drawing a circle with the same dimensions?
- 8 replies
-
- performance
- bitmapdata
-
(and 2 more)
Tagged with:
-
Does anybody know how to subtract the alpha values from a shape? After hours of research, my best bet is to utilize an alpha filter (link) The current Shape.mask value does not seem to have an easy way to invert masks (link) Example of what I want to achieve:
-
Does anybody know how to subtract the alpha values from a shape? After hours of research, my best bet is to utilize an alpha filter (link) The current Shape.mask value does not seem to have an easy way to invert masks (link) Example of what I want to achieve:
-
Hi There, I'm new to Phaser, i want to develop game related to numbers. For this i want to generate random numbers dynamically with coloured circle or rectangle back ground. how to do this in phaser. please help, I have attached sample image. I don't want to create images, then add sprite. Is there a way to do it using graphics and text ? thanks in advance. Regards, StudyMark
-
Hi. I'm new to babylon.js and to WebGL in general. I've browsed through http://doc.babylonjs.com/tutorials but I'm still having difficulty in coming up on the correct ways on how I can achieve what I want. So I'm trying to replicate this arcade machine ( on the image attached ). I'll list the ways I can think of on achieving this: - for the bottom part that has a shape like this: \_/ From what I've read, babylon.js has a library for common shapes like cube, spheres etc. but not shapes like that. So the only option left is to use ribbon? - the controls I'm planning to make this using image texture and height map. - upper part same problem as the bottom part - lastly, the screen is there a way to make it somewhat glowing as if it was emitting light? Any advice or tips will be very helpful.
-
Shapes Love Numbers a js13k entry PLAY Hello, I would like to share with you a game I made for js13k compo. Game is almost done, so I would love to gather some feedback before I will submit it. Here are some topics that I would love to hear about: Did you find tutorial useful and not annoying? Did learning other game rules (not included in tutorial) through gameplay was okay? Is game fair? And of course if you score above 'awesome', post it here or on twitter (@kmisiowi), so maybe I will adjust new score range for level. Hope you enjoy it. PS Vote button doesn't do anything yet, after i submit the game it will link to js13k webpage.
-
Hi, the latest weeks I have been working on a little game. This is my first game using Phaser, so at the begining I started using the arcade physic system. But, with the arcade physic, it's just possible to handle sprite collisions by boxes. As far as I know, to create a sprite with other kind of collision shape, you need to use another physic system, like ninja. I was looking some info in the internet, and seeing some examples in the phaser official page. The only way I found to do that, was to use ninja physic, and create a tile with it in this way: game.physics.ninja.enableTile(sprite, TILE_SHAPE);Reading the code in the examples, I understood that, the possible tile shapes are those in this picture: http://examples.phaser.io/assets/physics/ninja-tiles128.png My problem was that my sprite didn't fit any shape in the picture. So finally, what I did was to create a group with two sprites, each of the sprites has it's own tile with a different shape (in my case, these shapes were 21 and 22). And then, apply the movement and all required properties to the group or to all the sprites in the case i needed it. My question is, is this the right way of doing this? Or is there any better way (cleaner, efficient, etc.) of doing this? Thanks in advance!
-
hello everybody! since one of rich's answers to the problem was to use a capsule (instead of a circle/rectangle) i tried to do this (although i don't actually understand how this could solve the problem) one problem with capsules is that it make the mentioned problem even worse (my player can now walk up walls for some reason) the main problem with this is that i don't see the physics body.. i always see a rectangle with the exact size of the sprite but altering parameters of the capsule changes the behavior of my player so i am certain it is applied correctly but not displayed. if i do this: (math.radians is a custom function to convert deg to rad) playershape = player.body.addCapsule(100,15,0,0,Math.radians(90))my player (which is 50 pixels in height) hovers about 25 pixels over the ground.. this seems to be correct because i set the distance between the two points to 100 .. it looks like this:
-
How to create it? - red line - polygon. - colorful squares - tile map - random or atlas file. How to set the polygon object I know. Here, too, and plan. How do I randomly impose sprites? What to do to create? To trim down the red line