2d

Modify the time value of a transition

筅森魡賤 提交于 2019-12-11 22:14:51
问题 How can i change the time value of a transition while is executing? For example I have the object "cesta" moving from the left to the right with a time of 4000ms then for some reason I want to change the time value to move it faster. function createCesta() ... transition.to(cesta, {time = 4000, x = screenW + 110}) ... end function touchScreen(event) if event.phase == "began" then end if event.phase == "ended" then --change the time value from here "from 4000 to 2000" end end 回答1: The docs at

Create 3d matrix from existing 2d matrix in Matlab

萝らか妹 提交于 2019-12-11 20:09:17
问题 I have a 2D matrix of dimensions 64 x 727. What I would like to do is separate each of the columns, creating a 3D matrix of dimensions 64 x 1 x 727. I have looked through several similar questions on here, but my limited matlab ability is preventing me from applying previous answers to my own issue. Many thanks, Robbie 回答1: Try reshape(matrix,64,1,727) if that doesn't produce what you want explain further. 回答2: Try this: x2d = rand(64, 727); x3d = reshape(x2d, 64, 1, 727); 回答3: Use: permute

What's the best way of reading a sprite sheet in Java?

吃可爱长大的小学妹 提交于 2019-12-11 18:25:14
问题 I'm writing a basic sprite engine for my own amusement and to get better aquainted with Java's 2d API. Currently I am making use of large numbers of separate .png files with transparent backgrounds to represent the various sprites and different frames of animation that I need. Most 'real world' game development projects seem to make use of 'sprite sheets' which contain multiple sprites or frames of animation within a single file. Also, rather than making use of native image transparency

How to drag images / objects within Canvas?

南楼画角 提交于 2019-12-11 18:04:50
问题 1) On Canvas I am drawing SVG file (awesome_tiger.svg) with drawSvg (canvg). 2) On that SVG file I am plotting images* (green1.png and pink.png) * whose co-ordinates are getting from JSON. var dataJSON = data || []; var dataJSON2 = data2 || []; 3) So on I am able to pan complete drawing which I am drawing with draw1(scaleValue). 4) When I click on green.png and pink.png then their respective tooltip is able to view that is done in tooltipFunc function. 5) What I want to do is, when click on

C, Multi-Dimensional Arrays Exercise

孤人 提交于 2019-12-11 16:47:29
问题 My understanding of a 2d array is wrong. So I'll approach this question another way. Say I have the following variables. int student_id[10], course_id[5]; int student_course[10][2]; There can only be 10 students. There can only be 5 courses. A student can only take 2 courses. /*prompt user for student id*/ /* say that the value for: student_id[0]=123 */ /*prompt user for course id*/ /* say that the value for: course_id[0]=101 course_id[1]=102 course_id[2]=103 course_id[3]=104 course_id[4]=105

Count of Equal Adjacent Elements in 2D Array

回眸只為那壹抹淺笑 提交于 2019-12-11 16:05:56
问题 I am working on a programming assignment and stuck on one part. The directions ask to create a count for equal adjacent elements within a 2d array. I have tried setting up 2 for loops followed by if statements with multiple conditions using "or" to test if the elements are equal. The issue is the if statement can only be used for elements bounded within the array. The function i tried is shown below int count(int** t, int r, int c) { int i, j, count = 0; for (i = 0; i < r; i++) { for (j = 0;

Unity - Can I make a mirror in 2D?

限于喜欢 提交于 2019-12-11 15:16:41
问题 I am making a topdown tilebased 2D game. In this game, I want to make 1 of the walls into a mirror, like you can see on this video. Now, I know the game in the trailer is made in RPG Maker, but I want to make my game in Unity 3D. I have tried to set a camera right next to the mirror, add a RenderTexture on the camera and set that texture on the Sprite, but of course it is not possible to convert a RenderTexture to a Sprite, so this did not end up working. So my question is, is it possible to

How can I turn random matrix into a table?

自闭症网瘾萝莉.ら 提交于 2019-12-11 14:52:53
问题 Here is the code I'm given. import random def create_random_matrix(rows_min, rows_max, cols_min, cols_max): matrix = [] # generate a random number for the number of rows # notice that randint works differently from similar functions # you have seen in that rows_min and rows_max are both inclusive # http://docs.python.org/3/library/random.html#random.randint rows = random.randint(rows_min, rows_max) for row in range(rows): # add a row to the matrix matrix.append([]) # generate a random number

Making a ball bounce inside another ball

那年仲夏 提交于 2019-12-11 14:21:52
问题 There is plenty of information about how to make balls collide with one another on their outer boundaries, but I couldn't find anything that covers balls bouncing inside another ball . What would be the best way to accomplish this? I believe many people would benefit from this, including myself. 回答1: It is quite simple using Java 2D. /** A method to determine if area1 is entirely contained within area2. */ public boolean doAreasEnclose(Area area1, Area area2) { Area temp = new Area(area1);

Is there some standard functionality in XNA to efficiently implement a 2D Camera on a large world

谁都会走 提交于 2019-12-11 13:51:06
问题 I am making a 2d space game with many moving objects. I have already implemented a camera that can move around and draw the objects within the view. The problem now is that I have to check for every object wether it is within the rectangle of my view before I draw it (O( n ) operations where n is the number of objects in my world). I would like a more efficient way to acquire all the objects within the view so I only have to draw them. I know a bunch of data structures that can achieve a O